// $ANTLR 3.1.3 Mar 17, 2009 19:23:44 ttcn3.g 2009-04-30 09:53:55

package org.yatr.yatrc;

import java.util.HashMap;
import java.util.LinkedHashMap;
import org.yatr.yatrc.TType;
import static org.yatr.yatrc.TType.*;
import static org.yatr.yatrc.Log.*;
import static org.yatr.yatrc.Symtbl.*;
import org.yatr.yatrc.Symtbl.*;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;

import org.antlr.runtime.tree.*;

public class ttcn3Parser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "FUNC_CALL", "BLOCK", "UNARY_EXPR", "ACTUAL_ARGS", "FORMAL_ARGS", "FORMAL_VAR", "FIELD_ACCESS", "RUNS_ON", "PORT_REF", "SINGLE_CONNECT", "RCURLY", "LCURLY", "INT", "Cstring", "ID", "EscapeSequence", "WS", "COMMENT", "LINE_COMMENT", "'module'", "';'", "'control'", "'import'", "'from'", "'all'", "'type'", "'record'", "','", "'component'", "'integer'", "'charstring'", "'boolean'", "'const'", "':='", "'function'", "'('", "')'", "'return'", "'runs'", "'on'", "'testcase'", "'system'", "'var'", "'connect'", "':'", "'self'", "'mtc'", "'disconnect'", "'map'", "'unmap'", "'.'", "'start'", "'execute'", "'for'", "'if'", "'else'", "'log'", "'=='", "'!='", "'<'", "'<='", "'>'", "'>='", "'+'", "'-'", "'&'", "'*'", "'/'", "'mod'", "'true'", "'false'", "'create'"
    };
    public static final int T__42=42;
    public static final int ACTUAL_ARGS=7;
    public static final int T__28=28;
    public static final int T__23=23;
    public static final int T__57=57;
    public static final int T__51=51;
    public static final int T__69=69;
    public static final int T__47=47;
    public static final int Cstring=17;
    public static final int T__73=73;
    public static final int T__50=50;
    public static final int T__65=65;
    public static final int T__72=72;
    public static final int T__70=70;
    public static final int T__67=67;
    public static final int BLOCK=5;
    public static final int T__74=74;
    public static final int T__39=39;
    public static final int RCURLY=14;
    public static final int T__30=30;
    public static final int T__46=46;
    public static final int T__52=52;
    public static final int LCURLY=15;
    public static final int T__68=68;
    public static final int T__62=62;
    public static final int EscapeSequence=19;
    public static final int INT=16;
    public static final int T__27=27;
    public static final int FORMAL_ARGS=8;
    public static final int T__24=24;
    public static final int T__49=49;
    public static final int T__61=61;
    public static final int T__59=59;
    public static final int T__48=48;
    public static final int T__54=54;
    public static final int T__34=34;
    public static final int RUNS_ON=11;
    public static final int T__56=56;
    public static final int ID=18;
    public static final int T__35=35;
    public static final int T__36=36;
    public static final int FIELD_ACCESS=10;
    public static final int WS=20;
    public static final int T__58=58;
    public static final int FORMAL_VAR=9;
    public static final int T__64=64;
    public static final int T__44=44;
    public static final int T__66=66;
    public static final int COMMENT=21;
    public static final int T__33=33;
    public static final int LINE_COMMENT=22;
    public static final int UNARY_EXPR=6;
    public static final int T__29=29;
    public static final int T__45=45;
    public static final int T__55=55;
    public static final int SINGLE_CONNECT=13;
    public static final int PORT_REF=12;
    public static final int T__63=63;
    public static final int T__75=75;
    public static final int T__43=43;
    public static final int T__31=31;
    public static final int T__40=40;
    public static final int EOF=-1;
    public static final int FUNC_CALL=4;
    public static final int T__53=53;
    public static final int T__32=32;
    public static final int T__38=38;
    public static final int T__37=37;
    public static final int T__26=26;
    public static final int T__25=25;
    public static final int T__60=60;
    public static final int T__41=41;
    public static final int T__71=71;

    // delegates
    // delegators


        public ttcn3Parser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public ttcn3Parser(TokenStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        
    protected TreeAdaptor adaptor = new CommonTreeAdaptor();

    public void setTreeAdaptor(TreeAdaptor adaptor) {
        this.adaptor = adaptor;
    }
    public TreeAdaptor getTreeAdaptor() {
        return adaptor;
    }

    public String[] getTokenNames() { return ttcn3Parser.tokenNames; }
    public String getGrammarFileName() { return "ttcn3.g"; }



    // save the var/const definition info
    TType gidType=null;
    Token gidToken=null;

    HashMap<String, Symtbl> symtblOfModules;

    HashMap<String, Symtbl> getSymtblOfModules() {
    	return symtblOfModules;
    }

    /*
     * if errorCount>0, the skip AST walker.
     */
    int errorCount = 0;
    int  getTtcnErrorCount() {
    	int err= errorCount + errorCount();
    	return err;
    }



    public static class ttcn3File_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "ttcn3File"
    // ttcn3.g:66:1: ttcn3File : ttcn3Modules ;
    public final ttcn3Parser.ttcn3File_return ttcn3File() throws RecognitionException {
        ttcn3Parser.ttcn3File_return retval = new ttcn3Parser.ttcn3File_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.ttcn3Modules_return ttcn3Modules1 = null;




        	symtblOfModules=new LinkedHashMap<String, Symtbl>();

        try {
            // ttcn3.g:75:2: ( ttcn3Modules )
            // ttcn3.g:75:4: ttcn3Modules
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_ttcn3Modules_in_ttcn3File113);
            ttcn3Modules1=ttcn3Modules();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, ttcn3Modules1.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
            if ( state.backtracking==0 ) {

              	/*
              	 * check for UNDEFINED types!!
              	 */

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "ttcn3File"

    public static class ttcn3Modules_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "ttcn3Modules"
    // ttcn3.g:78:1: ttcn3Modules : ( ( ttcn3Module )+ | EOF );
    public final ttcn3Parser.ttcn3Modules_return ttcn3Modules() throws RecognitionException {
        ttcn3Parser.ttcn3Modules_return retval = new ttcn3Parser.ttcn3Modules_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token EOF3=null;
        ttcn3Parser.ttcn3Module_return ttcn3Module2 = null;


        CommonTree EOF3_tree=null;

        try {
            // ttcn3.g:79:2: ( ( ttcn3Module )+ | EOF )
            int alt2=2;
            int LA2_0 = input.LA(1);

            if ( (LA2_0==23) ) {
                alt2=1;
            }
            else if ( (LA2_0==EOF) ) {
                alt2=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;
            }
            switch (alt2) {
                case 1 :
                    // ttcn3.g:79:4: ( ttcn3Module )+
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    // ttcn3.g:79:4: ( ttcn3Module )+
                    int cnt1=0;
                    loop1:
                    do {
                        int alt1=2;
                        int LA1_0 = input.LA(1);

                        if ( (LA1_0==23) ) {
                            alt1=1;
                        }


                        switch (alt1) {
                    	case 1 :
                    	    // ttcn3.g:0:0: ttcn3Module
                    	    {
                    	    pushFollow(FOLLOW_ttcn3Module_in_ttcn3Modules125);
                    	    ttcn3Module2=ttcn3Module();

                    	    state._fsp--;
                    	    if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) adaptor.addChild(root_0, ttcn3Module2.getTree());

                    	    }
                    	    break;

                    	default :
                    	    if ( cnt1 >= 1 ) break loop1;
                    	    if (state.backtracking>0) {state.failed=true; return retval;}
                                EarlyExitException eee =
                                    new EarlyExitException(1, input);
                                throw eee;
                        }
                        cnt1++;
                    } while (true);


                    }
                    break;
                case 2 :
                    // ttcn3.g:80:4: EOF
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    EOF3=(Token)match(input,EOF,FOLLOW_EOF_in_ttcn3Modules133); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    EOF3_tree = (CommonTree)adaptor.create(EOF3);
                    adaptor.addChild(root_0, EOF3_tree);
                    }

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "ttcn3Modules"

    protected static class ttcn3Module_scope {
        Symtbl symtbl;
        Token moduleIDName;
    }
    protected Stack ttcn3Module_stack = new Stack();

    public static class ttcn3Module_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "ttcn3Module"
    // ttcn3.g:83:1: ttcn3Module : 'module' id '{' ( moduleDefinitionList )? ( moduleControlPart )? '}' -> ^( 'module' id ( moduleDefinitionList )? ( moduleControlPart )? ) ;
    public final ttcn3Parser.ttcn3Module_return ttcn3Module() throws RecognitionException {
        ttcn3Module_stack.push(new ttcn3Module_scope());
        ttcn3Parser.ttcn3Module_return retval = new ttcn3Parser.ttcn3Module_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal4=null;
        Token char_literal6=null;
        Token char_literal9=null;
        ttcn3Parser.id_return id5 = null;

        ttcn3Parser.moduleDefinitionList_return moduleDefinitionList7 = null;

        ttcn3Parser.moduleControlPart_return moduleControlPart8 = null;


        CommonTree string_literal4_tree=null;
        CommonTree char_literal6_tree=null;
        CommonTree char_literal9_tree=null;
        RewriteRuleTokenStream stream_RCURLY=new RewriteRuleTokenStream(adaptor,"token RCURLY");
        RewriteRuleTokenStream stream_LCURLY=new RewriteRuleTokenStream(adaptor,"token LCURLY");
        RewriteRuleTokenStream stream_23=new RewriteRuleTokenStream(adaptor,"token 23");
        RewriteRuleSubtreeStream stream_moduleDefinitionList=new RewriteRuleSubtreeStream(adaptor,"rule moduleDefinitionList");
        RewriteRuleSubtreeStream stream_moduleControlPart=new RewriteRuleSubtreeStream(adaptor,"rule moduleControlPart");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");

        	((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl = new Symtbl();

        try {
            // ttcn3.g:94:2: ( 'module' id '{' ( moduleDefinitionList )? ( moduleControlPart )? '}' -> ^( 'module' id ( moduleDefinitionList )? ( moduleControlPart )? ) )
            // ttcn3.g:94:4: 'module' id '{' ( moduleDefinitionList )? ( moduleControlPart )? '}'
            {
            string_literal4=(Token)match(input,23,FOLLOW_23_in_ttcn3Module155); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_23.add(string_literal4);

            pushFollow(FOLLOW_id_in_ttcn3Module157);
            id5=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id5.getTree());
            if ( state.backtracking==0 ) {

              	        System.err.println("Parsering Module \""+(id5!=null?id5.text:null)+"\"...");
              	        ((ttcn3Module_scope)ttcn3Module_stack.peek()).moduleIDName =(id5!=null?id5.token:null);
              		    ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((id5!=null?id5.token:null), ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newModule((id5!=null?id5.token:null)));
              		
            }
            char_literal6=(Token)match(input,LCURLY,FOLLOW_LCURLY_in_ttcn3Module169); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_LCURLY.add(char_literal6);

            // ttcn3.g:101:4: ( moduleDefinitionList )?
            int alt3=2;
            int LA3_0 = input.LA(1);

            if ( (LA3_0==26||LA3_0==29||LA3_0==36||LA3_0==38||LA3_0==44) ) {
                alt3=1;
            }
            switch (alt3) {
                case 1 :
                    // ttcn3.g:0:0: moduleDefinitionList
                    {
                    pushFollow(FOLLOW_moduleDefinitionList_in_ttcn3Module174);
                    moduleDefinitionList7=moduleDefinitionList();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_moduleDefinitionList.add(moduleDefinitionList7.getTree());

                    }
                    break;

            }

            // ttcn3.g:102:4: ( moduleControlPart )?
            int alt4=2;
            int LA4_0 = input.LA(1);

            if ( (LA4_0==25) ) {
                alt4=1;
            }
            switch (alt4) {
                case 1 :
                    // ttcn3.g:0:0: moduleControlPart
                    {
                    pushFollow(FOLLOW_moduleControlPart_in_ttcn3Module180);
                    moduleControlPart8=moduleControlPart();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_moduleControlPart.add(moduleControlPart8.getTree());

                    }
                    break;

            }

            char_literal9=(Token)match(input,RCURLY,FOLLOW_RCURLY_in_ttcn3Module185); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_RCURLY.add(char_literal9);



            // AST REWRITE
            // elements: 23, moduleControlPart, moduleDefinitionList, id
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 105:3: -> ^( 'module' id ( moduleDefinitionList )? ( moduleControlPart )? )
            {
                // ttcn3.g:105:6: ^( 'module' id ( moduleDefinitionList )? ( moduleControlPart )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_23.nextNode(), root_1);

                adaptor.addChild(root_1, stream_id.nextTree());
                // ttcn3.g:105:20: ( moduleDefinitionList )?
                if ( stream_moduleDefinitionList.hasNext() ) {
                    adaptor.addChild(root_1, stream_moduleDefinitionList.nextTree());

                }
                stream_moduleDefinitionList.reset();
                // ttcn3.g:105:42: ( moduleControlPart )?
                if ( stream_moduleControlPart.hasNext() ) {
                    adaptor.addChild(root_1, stream_moduleControlPart.nextTree());

                }
                stream_moduleControlPart.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
            if ( state.backtracking==0 ) {

              symtblOfModules.put(((ttcn3Module_scope)ttcn3Module_stack.peek()).moduleIDName.getText(), ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl);

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
            ttcn3Module_stack.pop();
        }
        return retval;
    }
    // $ANTLR end "ttcn3Module"

    public static class semiColon_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "semiColon"
    // ttcn3.g:113:1: semiColon : ( ';' | {...}? ( ';' )? );
    public final ttcn3Parser.semiColon_return semiColon() throws RecognitionException {
        ttcn3Parser.semiColon_return retval = new ttcn3Parser.semiColon_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal10=null;
        Token char_literal11=null;

        CommonTree char_literal10_tree=null;
        CommonTree char_literal11_tree=null;

        try {
            // ttcn3.g:114:2: ( ';' | {...}? ( ';' )? )
            int alt6=2;
            int LA6_0 = input.LA(1);

            if ( (LA6_0==24) ) {
                int LA6_1 = input.LA(2);

                if ( (synpred5_ttcn3()) ) {
                    alt6=1;
                }
                else if ( (( (input.LA(-1)==RCURLY) || (input.LA(1)==RCURLY))) ) {
                    alt6=2;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 6, 1, input);

                    throw nvae;
                }
            }
            else if ( (LA6_0==EOF||LA6_0==RCURLY||LA6_0==ID||(LA6_0>=25 && LA6_0<=26)||LA6_0==29||LA6_0==36||LA6_0==38||LA6_0==41||LA6_0==44||(LA6_0>=46 && LA6_0<=47)||(LA6_0>=51 && LA6_0<=53)||(LA6_0>=56 && LA6_0<=58)||LA6_0==60) ) {
                alt6=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 6, 0, input);

                throw nvae;
            }
            switch (alt6) {
                case 1 :
                    // ttcn3.g:114:6: ';'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    char_literal10=(Token)match(input,24,FOLLOW_24_in_semiColon235); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal10_tree = (CommonTree)adaptor.create(char_literal10);
                    adaptor.addChild(root_0, char_literal10_tree);
                    }

                    }
                    break;
                case 2 :
                    // ttcn3.g:115:6: {...}? ( ';' )?
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    if ( !(( (input.LA(-1)==RCURLY) || (input.LA(1)==RCURLY))) ) {
                        if (state.backtracking>0) {state.failed=true; return retval;}
                        throw new FailedPredicateException(input, "semiColon", " (input.LA(-1)==RCURLY) || (input.LA(1)==RCURLY)");
                    }
                    // ttcn3.g:115:58: ( ';' )?
                    int alt5=2;
                    int LA5_0 = input.LA(1);

                    if ( (LA5_0==24) ) {
                        alt5=1;
                    }
                    switch (alt5) {
                        case 1 :
                            // ttcn3.g:115:59: ';'
                            {
                            char_literal11=(Token)match(input,24,FOLLOW_24_in_semiColon245); if (state.failed) return retval;
                            if ( state.backtracking==0 ) {
                            char_literal11_tree = (CommonTree)adaptor.create(char_literal11);
                            adaptor.addChild(root_0, char_literal11_tree);
                            }

                            }
                            break;

                    }


                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "semiColon"

    public static class moduleControlPart_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "moduleControlPart"
    // ttcn3.g:118:1: moduleControlPart : 'control' statementBlock -> ^( 'control' statementBlock ) ;
    public final ttcn3Parser.moduleControlPart_return moduleControlPart() throws RecognitionException {
        ttcn3Parser.moduleControlPart_return retval = new ttcn3Parser.moduleControlPart_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal12=null;
        ttcn3Parser.statementBlock_return statementBlock13 = null;


        CommonTree string_literal12_tree=null;
        RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25");
        RewriteRuleSubtreeStream stream_statementBlock=new RewriteRuleSubtreeStream(adaptor,"rule statementBlock");
        try {
            // ttcn3.g:119:5: ( 'control' statementBlock -> ^( 'control' statementBlock ) )
            // ttcn3.g:119:7: 'control' statementBlock
            {
            string_literal12=(Token)match(input,25,FOLLOW_25_in_moduleControlPart261); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_25.add(string_literal12);

            pushFollow(FOLLOW_statementBlock_in_moduleControlPart263);
            statementBlock13=statementBlock();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_statementBlock.add(statementBlock13.getTree());


            // AST REWRITE
            // elements: statementBlock, 25
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 120:7: -> ^( 'control' statementBlock )
            {
                // ttcn3.g:120:10: ^( 'control' statementBlock )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_25.nextNode(), root_1);

                adaptor.addChild(root_1, stream_statementBlock.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "moduleControlPart"

    public static class moduleDefinitionList_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "moduleDefinitionList"
    // ttcn3.g:123:1: moduleDefinitionList : ( moduleDefinition semiColon )+ -> ( moduleDefinition )+ ;
    public final ttcn3Parser.moduleDefinitionList_return moduleDefinitionList() throws RecognitionException {
        ttcn3Parser.moduleDefinitionList_return retval = new ttcn3Parser.moduleDefinitionList_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.moduleDefinition_return moduleDefinition14 = null;

        ttcn3Parser.semiColon_return semiColon15 = null;


        RewriteRuleSubtreeStream stream_moduleDefinition=new RewriteRuleSubtreeStream(adaptor,"rule moduleDefinition");
        RewriteRuleSubtreeStream stream_semiColon=new RewriteRuleSubtreeStream(adaptor,"rule semiColon");
        try {
            // ttcn3.g:124:2: ( ( moduleDefinition semiColon )+ -> ( moduleDefinition )+ )
            // ttcn3.g:124:4: ( moduleDefinition semiColon )+
            {
            // ttcn3.g:124:4: ( moduleDefinition semiColon )+
            int cnt7=0;
            loop7:
            do {
                int alt7=2;
                int LA7_0 = input.LA(1);

                if ( (LA7_0==26||LA7_0==29||LA7_0==36||LA7_0==38||LA7_0==44) ) {
                    alt7=1;
                }


                switch (alt7) {
            	case 1 :
            	    // ttcn3.g:124:5: moduleDefinition semiColon
            	    {
            	    pushFollow(FOLLOW_moduleDefinition_in_moduleDefinitionList292);
            	    moduleDefinition14=moduleDefinition();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_moduleDefinition.add(moduleDefinition14.getTree());
            	    pushFollow(FOLLOW_semiColon_in_moduleDefinitionList295);
            	    semiColon15=semiColon();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_semiColon.add(semiColon15.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt7 >= 1 ) break loop7;
            	    if (state.backtracking>0) {state.failed=true; return retval;}
                        EarlyExitException eee =
                            new EarlyExitException(7, input);
                        throw eee;
                }
                cnt7++;
            } while (true);



            // AST REWRITE
            // elements: moduleDefinition
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 125:3: -> ( moduleDefinition )+
            {
                if ( !(stream_moduleDefinition.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_moduleDefinition.hasNext() ) {
                    adaptor.addChild(root_0, stream_moduleDefinition.nextTree());

                }
                stream_moduleDefinition.reset();

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "moduleDefinitionList"

    public static class moduleDefinition_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "moduleDefinition"
    // ttcn3.g:128:1: moduleDefinition : ( typeDef | constDef | functionDef | importDef | testcaseDef );
    public final ttcn3Parser.moduleDefinition_return moduleDefinition() throws RecognitionException {
        ttcn3Parser.moduleDefinition_return retval = new ttcn3Parser.moduleDefinition_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.typeDef_return typeDef16 = null;

        ttcn3Parser.constDef_return constDef17 = null;

        ttcn3Parser.functionDef_return functionDef18 = null;

        ttcn3Parser.importDef_return importDef19 = null;

        ttcn3Parser.testcaseDef_return testcaseDef20 = null;



        try {
            // ttcn3.g:129:2: ( typeDef | constDef | functionDef | importDef | testcaseDef )
            int alt8=5;
            switch ( input.LA(1) ) {
            case 29:
                {
                alt8=1;
                }
                break;
            case 36:
                {
                alt8=2;
                }
                break;
            case 38:
                {
                alt8=3;
                }
                break;
            case 26:
                {
                alt8=4;
                }
                break;
            case 44:
                {
                alt8=5;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 8, 0, input);

                throw nvae;
            }

            switch (alt8) {
                case 1 :
                    // ttcn3.g:129:4: typeDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_typeDef_in_moduleDefinition318);
                    typeDef16=typeDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, typeDef16.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:130:4: constDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_constDef_in_moduleDefinition323);
                    constDef17=constDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, constDef17.getTree());

                    }
                    break;
                case 3 :
                    // ttcn3.g:131:4: functionDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_functionDef_in_moduleDefinition328);
                    functionDef18=functionDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, functionDef18.getTree());

                    }
                    break;
                case 4 :
                    // ttcn3.g:132:4: importDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_importDef_in_moduleDefinition333);
                    importDef19=importDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, importDef19.getTree());

                    }
                    break;
                case 5 :
                    // ttcn3.g:133:6: testcaseDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_testcaseDef_in_moduleDefinition340);
                    testcaseDef20=testcaseDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, testcaseDef20.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "moduleDefinition"

    public static class importDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "importDef"
    // ttcn3.g:136:1: importDef : 'import' 'from' id 'all' ;
    public final ttcn3Parser.importDef_return importDef() throws RecognitionException {
        ttcn3Parser.importDef_return retval = new ttcn3Parser.importDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal21=null;
        Token string_literal22=null;
        Token string_literal24=null;
        ttcn3Parser.id_return id23 = null;


        CommonTree string_literal21_tree=null;
        CommonTree string_literal22_tree=null;
        CommonTree string_literal24_tree=null;

        try {
            // ttcn3.g:137:2: ( 'import' 'from' id 'all' )
            // ttcn3.g:137:4: 'import' 'from' id 'all'
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal21=(Token)match(input,26,FOLLOW_26_in_importDef351); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal21_tree = (CommonTree)adaptor.create(string_literal21);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal21_tree, root_0);
            }
            string_literal22=(Token)match(input,27,FOLLOW_27_in_importDef354); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal22_tree = (CommonTree)adaptor.create(string_literal22);
            adaptor.addChild(root_0, string_literal22_tree);
            }
            pushFollow(FOLLOW_id_in_importDef356);
            id23=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, id23.getTree());
            string_literal24=(Token)match(input,28,FOLLOW_28_in_importDef358); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal24_tree = (CommonTree)adaptor.create(string_literal24);
            adaptor.addChild(root_0, string_literal24_tree);
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "importDef"

    public static class typeDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "typeDef"
    // ttcn3.g:140:1: typeDef : 'type' typeDefBody ;
    public final ttcn3Parser.typeDef_return typeDef() throws RecognitionException {
        ttcn3Parser.typeDef_return retval = new ttcn3Parser.typeDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal25=null;
        ttcn3Parser.typeDefBody_return typeDefBody26 = null;


        CommonTree string_literal25_tree=null;

        try {
            // ttcn3.g:141:2: ( 'type' typeDefBody )
            // ttcn3.g:141:4: 'type' typeDefBody
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal25=(Token)match(input,29,FOLLOW_29_in_typeDef369); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal25_tree = (CommonTree)adaptor.create(string_literal25);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal25_tree, root_0);
            }
            pushFollow(FOLLOW_typeDefBody_in_typeDef372);
            typeDefBody26=typeDefBody();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, typeDefBody26.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "typeDef"

    public static class typeDefBody_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "typeDefBody"
    // ttcn3.g:143:1: typeDefBody : ( ( 'record' | 'component' )=> structuredTypeDef | subTypeDef );
    public final ttcn3Parser.typeDefBody_return typeDefBody() throws RecognitionException {
        ttcn3Parser.typeDefBody_return retval = new ttcn3Parser.typeDefBody_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.structuredTypeDef_return structuredTypeDef27 = null;

        ttcn3Parser.subTypeDef_return subTypeDef28 = null;



        try {
            // ttcn3.g:144:2: ( ( 'record' | 'component' )=> structuredTypeDef | subTypeDef )
            int alt9=2;
            int LA9_0 = input.LA(1);

            if ( (LA9_0==30) && (synpred13_ttcn3())) {
                alt9=1;
            }
            else if ( (LA9_0==32) && (synpred13_ttcn3())) {
                alt9=1;
            }
            else if ( (LA9_0==ID||(LA9_0>=33 && LA9_0<=35)) ) {
                alt9=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 9, 0, input);

                throw nvae;
            }
            switch (alt9) {
                case 1 :
                    // ttcn3.g:144:4: ( 'record' | 'component' )=> structuredTypeDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_structuredTypeDef_in_typeDefBody392);
                    structuredTypeDef27=structuredTypeDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, structuredTypeDef27.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:145:3: subTypeDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_subTypeDef_in_typeDefBody396);
                    subTypeDef28=subTypeDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, subTypeDef28.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "typeDefBody"

    public static class structuredTypeDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "structuredTypeDef"
    // ttcn3.g:147:1: structuredTypeDef options {k=1; } : ( recordDef | componentDef );
    public final ttcn3Parser.structuredTypeDef_return structuredTypeDef() throws RecognitionException {
        ttcn3Parser.structuredTypeDef_return retval = new ttcn3Parser.structuredTypeDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.recordDef_return recordDef29 = null;

        ttcn3Parser.componentDef_return componentDef30 = null;



        try {
            // ttcn3.g:149:2: ( recordDef | componentDef )
            int alt10=2;
            int LA10_0 = input.LA(1);

            if ( (LA10_0==30) ) {
                alt10=1;
            }
            else if ( (LA10_0==32) ) {
                alt10=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 10, 0, input);

                throw nvae;
            }
            switch (alt10) {
                case 1 :
                    // ttcn3.g:149:4: recordDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_recordDef_in_structuredTypeDef413);
                    recordDef29=recordDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, recordDef29.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:150:4: componentDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_componentDef_in_structuredTypeDef418);
                    componentDef30=componentDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, componentDef30.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "structuredTypeDef"

    public static class recordDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "recordDef"
    // ttcn3.g:153:1: recordDef : 'record' structDefBody ;
    public final ttcn3Parser.recordDef_return recordDef() throws RecognitionException {
        ttcn3Parser.recordDef_return retval = new ttcn3Parser.recordDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal31=null;
        ttcn3Parser.structDefBody_return structDefBody32 = null;


        CommonTree string_literal31_tree=null;

        try {
            // ttcn3.g:154:2: ( 'record' structDefBody )
            // ttcn3.g:154:4: 'record' structDefBody
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal31=(Token)match(input,30,FOLLOW_30_in_recordDef429); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal31_tree = (CommonTree)adaptor.create(string_literal31);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal31_tree, root_0);
            }
            pushFollow(FOLLOW_structDefBody_in_recordDef432);
            structDefBody32=structDefBody();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, structDefBody32.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "recordDef"

    public static class structDefBody_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "structDefBody"
    // ttcn3.g:157:1: structDefBody : id '{' structFieldDef[t] ( ',' structFieldDef[t] )* '}' -> ^( id ( structFieldDef )+ ) ;
    public final ttcn3Parser.structDefBody_return structDefBody() throws RecognitionException {
        ttcn3Parser.structDefBody_return retval = new ttcn3Parser.structDefBody_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal34=null;
        Token char_literal36=null;
        Token char_literal38=null;
        ttcn3Parser.id_return id33 = null;

        ttcn3Parser.structFieldDef_return structFieldDef35 = null;

        ttcn3Parser.structFieldDef_return structFieldDef37 = null;


        CommonTree char_literal34_tree=null;
        CommonTree char_literal36_tree=null;
        CommonTree char_literal38_tree=null;
        RewriteRuleTokenStream stream_RCURLY=new RewriteRuleTokenStream(adaptor,"token RCURLY");
        RewriteRuleTokenStream stream_LCURLY=new RewriteRuleTokenStream(adaptor,"token LCURLY");
        RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
        RewriteRuleSubtreeStream stream_structFieldDef=new RewriteRuleSubtreeStream(adaptor,"rule structFieldDef");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");

        	TType t=null;

        try {
            // ttcn3.g:161:2: ( id '{' structFieldDef[t] ( ',' structFieldDef[t] )* '}' -> ^( id ( structFieldDef )+ ) )
            // ttcn3.g:161:4: id '{' structFieldDef[t] ( ',' structFieldDef[t] )* '}'
            {
            pushFollow(FOLLOW_id_in_structDefBody447);
            id33=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id33.getTree());
            if ( state.backtracking==0 ) {

              			t = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((id33!=null?id33.token:null), TAttrib.TYPE, null);
              			if(null == t) {
              				t = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newType((id33!=null?id33.token:null), TSubAttribTYPE.RECORD);
              				((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((id33!=null?id33.token:null), t);
              			}
              			t.doSubType((id33!=null?id33.token:null), TSubAttribTYPE.RECORD);
              		
            }
            char_literal34=(Token)match(input,LCURLY,FOLLOW_LCURLY_in_structDefBody454); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_LCURLY.add(char_literal34);

            pushFollow(FOLLOW_structFieldDef_in_structDefBody456);
            structFieldDef35=structFieldDef(t);

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_structFieldDef.add(structFieldDef35.getTree());
            // ttcn3.g:169:25: ( ',' structFieldDef[t] )*
            loop11:
            do {
                int alt11=2;
                int LA11_0 = input.LA(1);

                if ( (LA11_0==31) ) {
                    alt11=1;
                }


                switch (alt11) {
            	case 1 :
            	    // ttcn3.g:169:26: ',' structFieldDef[t]
            	    {
            	    char_literal36=(Token)match(input,31,FOLLOW_31_in_structDefBody460); if (state.failed) return retval; 
            	    if ( state.backtracking==0 ) stream_31.add(char_literal36);

            	    pushFollow(FOLLOW_structFieldDef_in_structDefBody462);
            	    structFieldDef37=structFieldDef(t);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_structFieldDef.add(structFieldDef37.getTree());

            	    }
            	    break;

            	default :
            	    break loop11;
                }
            } while (true);

            char_literal38=(Token)match(input,RCURLY,FOLLOW_RCURLY_in_structDefBody470); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_RCURLY.add(char_literal38);



            // AST REWRITE
            // elements: structFieldDef, id
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 171:3: -> ^( id ( structFieldDef )+ )
            {
                // ttcn3.g:171:5: ^( id ( structFieldDef )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_id.nextNode(), root_1);

                if ( !(stream_structFieldDef.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_structFieldDef.hasNext() ) {
                    adaptor.addChild(root_1, stream_structFieldDef.nextTree());

                }
                stream_structFieldDef.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "structDefBody"

    public static class structFieldDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "structFieldDef"
    // ttcn3.g:173:1: structFieldDef[TType t] : oldtype1= typeName id1= id -> ^( id typeName ) ;
    public final ttcn3Parser.structFieldDef_return structFieldDef(TType t) throws RecognitionException {
        ttcn3Parser.structFieldDef_return retval = new ttcn3Parser.structFieldDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.typeName_return oldtype1 = null;

        ttcn3Parser.id_return id1 = null;


        RewriteRuleSubtreeStream stream_typeName=new RewriteRuleSubtreeStream(adaptor,"rule typeName");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");
        try {
            // ttcn3.g:174:2: (oldtype1= typeName id1= id -> ^( id typeName ) )
            // ttcn3.g:174:4: oldtype1= typeName id1= id
            {
            pushFollow(FOLLOW_typeName_in_structFieldDef494);
            oldtype1=typeName();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_typeName.add(oldtype1.getTree());
            pushFollow(FOLLOW_id_in_structFieldDef498);
            id1=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id1.getTree());
            if ( state.backtracking==0 ) {
              t.addSubTableItem((id1!=null?id1.token:null), newValue((id1!=null?id1.token:null), TSubAttribVALUE.VAR, (oldtype1!=null?oldtype1.t:null)));
            }


            // AST REWRITE
            // elements: typeName, id
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 175:3: -> ^( id typeName )
            {
                // ttcn3.g:175:6: ^( id typeName )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_id.nextNode(), root_1);

                adaptor.addChild(root_1, stream_typeName.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "structFieldDef"

    public static class subTypeDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "subTypeDef"
    // ttcn3.g:178:1: subTypeDef : typeName id -> ^( id typeName ) ;
    public final ttcn3Parser.subTypeDef_return subTypeDef() throws RecognitionException {
        ttcn3Parser.subTypeDef_return retval = new ttcn3Parser.subTypeDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.typeName_return typeName39 = null;

        ttcn3Parser.id_return id40 = null;


        RewriteRuleSubtreeStream stream_typeName=new RewriteRuleSubtreeStream(adaptor,"rule typeName");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");
        try {
            // ttcn3.g:179:2: ( typeName id -> ^( id typeName ) )
            // ttcn3.g:179:4: typeName id
            {
            pushFollow(FOLLOW_typeName_in_subTypeDef523);
            typeName39=typeName();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_typeName.add(typeName39.getTree());
            pushFollow(FOLLOW_id_in_subTypeDef525);
            id40=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id40.getTree());
            if ( state.backtracking==0 ) {

              			TType t = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((id40!=null?id40.token:null), TAttrib.TYPE, null);
              			if(null == t) {
              		 		((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((id40!=null?id40.token:null), newType((id40!=null?id40.token:null), (TSubAttribTYPE)(typeName39!=null?typeName39.t:null).getSubAttrib()));
              		 		t = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((id40!=null?id40.token:null), TAttrib.TYPE, null);
              		 	}
              		 	t.setToken((id40!=null?id40.token:null));
              		 	
              		 	if((typeName39!=null?typeName39.t:null).getSubAttrib()!=TSubAttribTYPE.UNKNOWN) {
               				 	t.doSubType((typeName39!=null?typeName39.t:null));
              		 	} else {
              		 			(typeName39!=null?typeName39.t:null).appendSubType(t);
              		 	}
              		
            }


            // AST REWRITE
            // elements: id, typeName
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 194:3: -> ^( id typeName )
            {
                // ttcn3.g:194:5: ^( id typeName )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_id.nextNode(), root_1);

                adaptor.addChild(root_1, stream_typeName.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "subTypeDef"

    public static class componentDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "componentDef"
    // ttcn3.g:234:1: componentDef : 'component' id '{' ( componentDefList[type] )? '}' -> ^( 'component' id ( componentDefList )? ) ;
    public final ttcn3Parser.componentDef_return componentDef() throws RecognitionException {
        ttcn3Parser.componentDef_return retval = new ttcn3Parser.componentDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal41=null;
        Token char_literal43=null;
        Token char_literal45=null;
        ttcn3Parser.id_return id42 = null;

        ttcn3Parser.componentDefList_return componentDefList44 = null;


        CommonTree string_literal41_tree=null;
        CommonTree char_literal43_tree=null;
        CommonTree char_literal45_tree=null;
        RewriteRuleTokenStream stream_32=new RewriteRuleTokenStream(adaptor,"token 32");
        RewriteRuleTokenStream stream_RCURLY=new RewriteRuleTokenStream(adaptor,"token RCURLY");
        RewriteRuleTokenStream stream_LCURLY=new RewriteRuleTokenStream(adaptor,"token LCURLY");
        RewriteRuleSubtreeStream stream_componentDefList=new RewriteRuleSubtreeStream(adaptor,"rule componentDefList");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");

        	TType type=null;

        try {
            // ttcn3.g:238:2: ( 'component' id '{' ( componentDefList[type] )? '}' -> ^( 'component' id ( componentDefList )? ) )
            // ttcn3.g:238:4: 'component' id '{' ( componentDefList[type] )? '}'
            {
            string_literal41=(Token)match(input,32,FOLLOW_32_in_componentDef555); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_32.add(string_literal41);

            pushFollow(FOLLOW_id_in_componentDef557);
            id42=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id42.getTree());
            if ( state.backtracking==0 ) {

              		   	 //type = addID2Module(((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl, (id42!=null?id42.token:null), TAttrib.COMPONENT);
              		   	 type = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((id42!=null?id42.token:null), TAttrib.TYPE, null);
              		   	 if(null == type) {
              		   	 	 type=((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newType((id42!=null?id42.token:null), TSubAttribTYPE.COMPONENT);
              		   	 	 ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((id42!=null?id42.token:null), type);
              		   	 	 type.doSubType((id42!=null?id42.token:null), TSubAttribTYPE.COMPONENT);
              		   	} else {
              		   		logError((id42!=null?id42.token:null), "multi-defined symbol.");
              		   		if(type.getToken()!=null)
              		   			logError(type.getToken(), "previous defined here.");
              		   	 }
              		   	 
              		 
            }
            char_literal43=(Token)match(input,LCURLY,FOLLOW_LCURLY_in_componentDef566); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_LCURLY.add(char_literal43);

            // ttcn3.g:254:6: ( componentDefList[type] )?
            int alt12=2;
            int LA12_0 = input.LA(1);

            if ( (LA12_0==36||LA12_0==46) ) {
                alt12=1;
            }
            switch (alt12) {
                case 1 :
                    // ttcn3.g:0:0: componentDefList[type]
                    {
                    pushFollow(FOLLOW_componentDefList_in_componentDef573);
                    componentDefList44=componentDefList(type);

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_componentDefList.add(componentDefList44.getTree());

                    }
                    break;

            }

            char_literal45=(Token)match(input,RCURLY,FOLLOW_RCURLY_in_componentDef579); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_RCURLY.add(char_literal45);



            // AST REWRITE
            // elements: id, componentDefList, 32
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 256:3: -> ^( 'component' id ( componentDefList )? )
            {
                // ttcn3.g:256:6: ^( 'component' id ( componentDefList )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_32.nextNode(), root_1);

                adaptor.addChild(root_1, stream_id.nextTree());
                // ttcn3.g:256:23: ( componentDefList )?
                if ( stream_componentDefList.hasNext() ) {
                    adaptor.addChild(root_1, stream_componentDefList.nextTree());

                }
                stream_componentDefList.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "componentDef"

    public static class componentDefList_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "componentDefList"
    // ttcn3.g:258:1: componentDefList[TType type] : ( componentElementDef[$type] semiColon )+ -> ( componentElementDef )+ ;
    public final ttcn3Parser.componentDefList_return componentDefList(TType type) throws RecognitionException {
        ttcn3Parser.componentDefList_return retval = new ttcn3Parser.componentDefList_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.componentElementDef_return componentElementDef46 = null;

        ttcn3Parser.semiColon_return semiColon47 = null;


        RewriteRuleSubtreeStream stream_componentElementDef=new RewriteRuleSubtreeStream(adaptor,"rule componentElementDef");
        RewriteRuleSubtreeStream stream_semiColon=new RewriteRuleSubtreeStream(adaptor,"rule semiColon");
        try {
            // ttcn3.g:259:2: ( ( componentElementDef[$type] semiColon )+ -> ( componentElementDef )+ )
            // ttcn3.g:259:4: ( componentElementDef[$type] semiColon )+
            {
            // ttcn3.g:259:4: ( componentElementDef[$type] semiColon )+
            int cnt13=0;
            loop13:
            do {
                int alt13=2;
                int LA13_0 = input.LA(1);

                if ( (LA13_0==36||LA13_0==46) ) {
                    alt13=1;
                }


                switch (alt13) {
            	case 1 :
            	    // ttcn3.g:259:5: componentElementDef[$type] semiColon
            	    {
            	    pushFollow(FOLLOW_componentElementDef_in_componentDefList606);
            	    componentElementDef46=componentElementDef(type);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_componentElementDef.add(componentElementDef46.getTree());
            	    pushFollow(FOLLOW_semiColon_in_componentDefList609);
            	    semiColon47=semiColon();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_semiColon.add(semiColon47.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt13 >= 1 ) break loop13;
            	    if (state.backtracking>0) {state.failed=true; return retval;}
                        EarlyExitException eee =
                            new EarlyExitException(13, input);
                        throw eee;
                }
                cnt13++;
            } while (true);



            // AST REWRITE
            // elements: componentElementDef
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 260:3: -> ( componentElementDef )+
            {
                if ( !(stream_componentElementDef.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_componentElementDef.hasNext() ) {
                    adaptor.addChild(root_0, stream_componentElementDef.nextTree());

                }
                stream_componentElementDef.reset();

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "componentDefList"

    public static class componentElementDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "componentElementDef"
    // ttcn3.g:262:1: componentElementDef[TType t] : ( varInstance | constDef );
    public final ttcn3Parser.componentElementDef_return componentElementDef(TType t) throws RecognitionException {
        ttcn3Parser.componentElementDef_return retval = new ttcn3Parser.componentElementDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.varInstance_return varInstance48 = null;

        ttcn3Parser.constDef_return constDef49 = null;



        try {
            // ttcn3.g:263:2: ( varInstance | constDef )
            int alt14=2;
            int LA14_0 = input.LA(1);

            if ( (LA14_0==46) ) {
                alt14=1;
            }
            else if ( (LA14_0==36) ) {
                alt14=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 14, 0, input);

                throw nvae;
            }
            switch (alt14) {
                case 1 :
                    // ttcn3.g:263:4: varInstance
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_varInstance_in_componentElementDef631);
                    varInstance48=varInstance();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, varInstance48.getTree());
                    if ( state.backtracking==0 ) {
                      t.addSubTableItem(gidToken, newValue(gidToken, TSubAttribVALUE.VAR, gidType)); 
                      				//System.out.println("varInstance token="+gidToken.getText());
                      				
                    }

                    }
                    break;
                case 2 :
                    // ttcn3.g:266:4: constDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_constDef_in_componentElementDef639);
                    constDef49=constDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, constDef49.getTree());
                    if ( state.backtracking==0 ) {
                      t.addSubTableItem(gidToken, newValue(gidToken, TSubAttribVALUE.VAR, gidType));
                    }

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "componentElementDef"

    public static class typeName_return extends ParserRuleReturnScope {
        public TType t;
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "typeName"
    // ttcn3.g:270:1: typeName returns [TType t] : (pt= 'integer' | pt= 'charstring' | pt= 'boolean' | pt2= id );
    public final ttcn3Parser.typeName_return typeName() throws RecognitionException {
        ttcn3Parser.typeName_return retval = new ttcn3Parser.typeName_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token pt=null;
        ttcn3Parser.id_return pt2 = null;


        CommonTree pt_tree=null;


        TSubAttribTYPE subt = TSubAttribTYPE.UNKNOWN;

        try {
            // ttcn3.g:274:2: (pt= 'integer' | pt= 'charstring' | pt= 'boolean' | pt2= id )
            int alt15=4;
            switch ( input.LA(1) ) {
            case 33:
                {
                alt15=1;
                }
                break;
            case 34:
                {
                alt15=2;
                }
                break;
            case 35:
                {
                alt15=3;
                }
                break;
            case ID:
                {
                alt15=4;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 15, 0, input);

                throw nvae;
            }

            switch (alt15) {
                case 1 :
                    // ttcn3.g:274:4: pt= 'integer'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pt=(Token)match(input,33,FOLLOW_33_in_typeName668); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    pt_tree = (CommonTree)adaptor.create(pt);
                    adaptor.addChild(root_0, pt_tree);
                    }
                    if ( state.backtracking==0 ) {
                      retval.t = getPredefinedType((pt!=null?pt.getText():null));
                    }

                    }
                    break;
                case 2 :
                    // ttcn3.g:275:4: pt= 'charstring'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pt=(Token)match(input,34,FOLLOW_34_in_typeName677); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    pt_tree = (CommonTree)adaptor.create(pt);
                    adaptor.addChild(root_0, pt_tree);
                    }
                    if ( state.backtracking==0 ) {
                      retval.t = getPredefinedType((pt!=null?pt.getText():null));
                    }

                    }
                    break;
                case 3 :
                    // ttcn3.g:276:4: pt= 'boolean'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pt=(Token)match(input,35,FOLLOW_35_in_typeName686); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    pt_tree = (CommonTree)adaptor.create(pt);
                    adaptor.addChild(root_0, pt_tree);
                    }
                    if ( state.backtracking==0 ) {
                      retval.t = getPredefinedType((pt!=null?pt.getText():null));
                    }

                    }
                    break;
                case 4 :
                    // ttcn3.g:277:4: pt2= id
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_id_in_typeName695);
                    pt2=id();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, pt2.getTree());
                    if ( state.backtracking==0 ) {
                      subt = TSubAttribTYPE.UNKNOWN;
                    }
                    if ( state.backtracking==0 ) {
                      	retval.t = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((pt2!=null?pt2.token:null), TAttrib.TYPE, null);
                      			 if(retval.t==null) {
                      			 	TType tt=((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newType((pt2!=null?pt2.token:null), subt);
                      			 	((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((pt2!=null?pt2.token:null), tt);
                      			 	retval.t = tt;
                      			}
                      		
                    }

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "typeName"

    public static class constDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "constDef"
    // ttcn3.g:287:1: constDef : 'const' typeName constInitial[t] ( ',' constInitial[t] )* -> ^( 'const' typeName ( constInitial )+ ) ;
    public final ttcn3Parser.constDef_return constDef() throws RecognitionException {
        ttcn3Parser.constDef_return retval = new ttcn3Parser.constDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal50=null;
        Token char_literal53=null;
        ttcn3Parser.typeName_return typeName51 = null;

        ttcn3Parser.constInitial_return constInitial52 = null;

        ttcn3Parser.constInitial_return constInitial54 = null;


        CommonTree string_literal50_tree=null;
        CommonTree char_literal53_tree=null;
        RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
        RewriteRuleTokenStream stream_36=new RewriteRuleTokenStream(adaptor,"token 36");
        RewriteRuleSubtreeStream stream_constInitial=new RewriteRuleSubtreeStream(adaptor,"rule constInitial");
        RewriteRuleSubtreeStream stream_typeName=new RewriteRuleSubtreeStream(adaptor,"rule typeName");

         TType t=null;
         gidType=null;
         gidToken=null;

        try {
            // ttcn3.g:297:2: ( 'const' typeName constInitial[t] ( ',' constInitial[t] )* -> ^( 'const' typeName ( constInitial )+ ) )
            // ttcn3.g:297:4: 'const' typeName constInitial[t] ( ',' constInitial[t] )*
            {
            string_literal50=(Token)match(input,36,FOLLOW_36_in_constDef721); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_36.add(string_literal50);

            pushFollow(FOLLOW_typeName_in_constDef724);
            typeName51=typeName();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_typeName.add(typeName51.getTree());
            if ( state.backtracking==0 ) {
               t = (typeName51!=null?typeName51.t:null);
            }
            pushFollow(FOLLOW_constInitial_in_constDef741);
            constInitial52=constInitial(t);

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_constInitial.add(constInitial52.getTree());
            // ttcn3.g:298:30: ( ',' constInitial[t] )*
            loop16:
            do {
                int alt16=2;
                int LA16_0 = input.LA(1);

                if ( (LA16_0==31) ) {
                    alt16=1;
                }


                switch (alt16) {
            	case 1 :
            	    // ttcn3.g:298:31: ',' constInitial[t]
            	    {
            	    char_literal53=(Token)match(input,31,FOLLOW_31_in_constDef745); if (state.failed) return retval; 
            	    if ( state.backtracking==0 ) stream_31.add(char_literal53);

            	    pushFollow(FOLLOW_constInitial_in_constDef747);
            	    constInitial54=constInitial(t);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_constInitial.add(constInitial54.getTree());

            	    }
            	    break;

            	default :
            	    break loop16;
                }
            } while (true);



            // AST REWRITE
            // elements: typeName, 36, constInitial
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 299:3: -> ^( 'const' typeName ( constInitial )+ )
            {
                // ttcn3.g:299:6: ^( 'const' typeName ( constInitial )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_36.nextNode(), root_1);

                adaptor.addChild(root_1, stream_typeName.nextTree());
                if ( !(stream_constInitial.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_constInitial.hasNext() ) {
                    adaptor.addChild(root_1, stream_constInitial.nextTree());

                }
                stream_constInitial.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
            if ( state.backtracking==0 ) {

              // gidType=null;
              // gidToken=null;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "constDef"

    public static class constInitial_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "constInitial"
    // ttcn3.g:303:1: constInitial[TType t] : id ':=' constExpr ;
    public final ttcn3Parser.constInitial_return constInitial(TType t) throws RecognitionException {
        ttcn3Parser.constInitial_return retval = new ttcn3Parser.constInitial_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal56=null;
        ttcn3Parser.id_return id55 = null;

        ttcn3Parser.constExpr_return constExpr57 = null;


        CommonTree string_literal56_tree=null;

        try {
            // ttcn3.g:304:2: ( id ':=' constExpr )
            // ttcn3.g:304:4: id ':=' constExpr
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_id_in_constInitial782);
            id55=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, id55.getTree());
            string_literal56=(Token)match(input,37,FOLLOW_37_in_constInitial784); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal56_tree = (CommonTree)adaptor.create(string_literal56);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal56_tree, root_0);
            }
            pushFollow(FOLLOW_constExpr_in_constInitial787);
            constExpr57=constExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, constExpr57.getTree());
            if ( state.backtracking==0 ) {

              					TType v = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newValue((id55!=null?id55.token:null), TSubAttribVALUE.CONST, t);
              					((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((id55!=null?id55.token:null), v);
              					
              					///
              					gidType=t;
              					gidToken=(id55!=null?id55.token:null);
              				
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "constInitial"

    public static class functionDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionDef"
    // ttcn3.g:314:1: functionDef : 'function' id '(' ( functionFormalParList[type] )? ')' ( runsOnSpec )? ( returnType )? statementBlock -> ^( 'function' id ( functionFormalParList )? ( runsOnSpec )? ( returnType )? statementBlock ) ;
    public final ttcn3Parser.functionDef_return functionDef() throws RecognitionException {
        ttcn3Parser.functionDef_return retval = new ttcn3Parser.functionDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal58=null;
        Token char_literal60=null;
        Token char_literal62=null;
        ttcn3Parser.id_return id59 = null;

        ttcn3Parser.functionFormalParList_return functionFormalParList61 = null;

        ttcn3Parser.runsOnSpec_return runsOnSpec63 = null;

        ttcn3Parser.returnType_return returnType64 = null;

        ttcn3Parser.statementBlock_return statementBlock65 = null;


        CommonTree string_literal58_tree=null;
        CommonTree char_literal60_tree=null;
        CommonTree char_literal62_tree=null;
        RewriteRuleTokenStream stream_38=new RewriteRuleTokenStream(adaptor,"token 38");
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_statementBlock=new RewriteRuleSubtreeStream(adaptor,"rule statementBlock");
        RewriteRuleSubtreeStream stream_functionFormalParList=new RewriteRuleSubtreeStream(adaptor,"rule functionFormalParList");
        RewriteRuleSubtreeStream stream_runsOnSpec=new RewriteRuleSubtreeStream(adaptor,"rule runsOnSpec");
        RewriteRuleSubtreeStream stream_returnType=new RewriteRuleSubtreeStream(adaptor,"rule returnType");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");

         TType type=null;

        try {
            // ttcn3.g:318:2: ( 'function' id '(' ( functionFormalParList[type] )? ')' ( runsOnSpec )? ( returnType )? statementBlock -> ^( 'function' id ( functionFormalParList )? ( runsOnSpec )? ( returnType )? statementBlock ) )
            // ttcn3.g:318:4: 'function' id '(' ( functionFormalParList[type] )? ')' ( runsOnSpec )? ( returnType )? statementBlock
            {
            string_literal58=(Token)match(input,38,FOLLOW_38_in_functionDef804); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_38.add(string_literal58);

            pushFollow(FOLLOW_id_in_functionDef806);
            id59=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id59.getTree());
            if ( state.backtracking==0 ) {

              	   	 //type = addID2Module(((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl, (id59!=null?id59.token:null), TAttrib.FUNCTION);
              	   	 
              	   	 type = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((id59!=null?id59.token:null), TAttrib.FUNCTION, null);
              	   	 if(null == type) {
              	   	 	 type=((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newFunction((id59!=null?id59.token:null));
              	   	 	 ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((id59!=null?id59.token:null), type);
              	   	} else {
              	   		logError((id59!=null?id59.token:null), "multi-defined symbol.");
              	   		if(type.getToken()!=null)
              	   			logError(type.getToken(), "previous defined here.");
              	   	}
              	  
            }
            char_literal60=(Token)match(input,39,FOLLOW_39_in_functionDef818); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal60);

            // ttcn3.g:332:8: ( functionFormalParList[type] )?
            int alt17=2;
            int LA17_0 = input.LA(1);

            if ( (LA17_0==ID||(LA17_0>=33 && LA17_0<=35)) ) {
                alt17=1;
            }
            switch (alt17) {
                case 1 :
                    // ttcn3.g:0:0: functionFormalParList[type]
                    {
                    pushFollow(FOLLOW_functionFormalParList_in_functionDef820);
                    functionFormalParList61=functionFormalParList(type);

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_functionFormalParList.add(functionFormalParList61.getTree());

                    }
                    break;

            }

            char_literal62=(Token)match(input,40,FOLLOW_40_in_functionDef824); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal62);

            // ttcn3.g:332:41: ( runsOnSpec )?
            int alt18=2;
            int LA18_0 = input.LA(1);

            if ( (LA18_0==42) ) {
                alt18=1;
            }
            switch (alt18) {
                case 1 :
                    // ttcn3.g:0:0: runsOnSpec
                    {
                    pushFollow(FOLLOW_runsOnSpec_in_functionDef826);
                    runsOnSpec63=runsOnSpec();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_runsOnSpec.add(runsOnSpec63.getTree());

                    }
                    break;

            }

            // ttcn3.g:332:53: ( returnType )?
            int alt19=2;
            int LA19_0 = input.LA(1);

            if ( (LA19_0==41) ) {
                alt19=1;
            }
            switch (alt19) {
                case 1 :
                    // ttcn3.g:0:0: returnType
                    {
                    pushFollow(FOLLOW_returnType_in_functionDef829);
                    returnType64=returnType();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_returnType.add(returnType64.getTree());

                    }
                    break;

            }

            if ( state.backtracking==0 ) {

              	   	if((returnType64!=null?returnType64.t:null)!=null){
              	   		type.setType((returnType64!=null?returnType64.t:null));
              	   	}

              	   	if((runsOnSpec63!=null?runsOnSpec63.compName:null)!=null) {
              	   		//System.out.println("func:"+(id59!=null?id59.text:null)+" runs on "+(runsOnSpec63!=null?runsOnSpec63.compName:null));
              	   		((FunctionType)type).setRunsOnComp((runsOnSpec63!=null?runsOnSpec63.compName:null));
              	   	}
              	   
            }
            pushFollow(FOLLOW_statementBlock_in_functionDef840);
            statementBlock65=statementBlock();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_statementBlock.add(statementBlock65.getTree());


            // AST REWRITE
            // elements: returnType, functionFormalParList, 38, id, statementBlock, runsOnSpec
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 344:3: -> ^( 'function' id ( functionFormalParList )? ( runsOnSpec )? ( returnType )? statementBlock )
            {
                // ttcn3.g:344:5: ^( 'function' id ( functionFormalParList )? ( runsOnSpec )? ( returnType )? statementBlock )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_38.nextNode(), root_1);

                adaptor.addChild(root_1, stream_id.nextTree());
                // ttcn3.g:344:21: ( functionFormalParList )?
                if ( stream_functionFormalParList.hasNext() ) {
                    adaptor.addChild(root_1, stream_functionFormalParList.nextTree());

                }
                stream_functionFormalParList.reset();
                // ttcn3.g:344:44: ( runsOnSpec )?
                if ( stream_runsOnSpec.hasNext() ) {
                    adaptor.addChild(root_1, stream_runsOnSpec.nextTree());

                }
                stream_runsOnSpec.reset();
                // ttcn3.g:344:56: ( returnType )?
                if ( stream_returnType.hasNext() ) {
                    adaptor.addChild(root_1, stream_returnType.nextTree());

                }
                stream_returnType.reset();
                adaptor.addChild(root_1, stream_statementBlock.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionDef"

    public static class returnType_return extends ParserRuleReturnScope {
        public TType t;
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "returnType"
    // ttcn3.g:347:1: returnType returns [TType t] : 'return' typeName ;
    public final ttcn3Parser.returnType_return returnType() throws RecognitionException {
        ttcn3Parser.returnType_return retval = new ttcn3Parser.returnType_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal66=null;
        ttcn3Parser.typeName_return typeName67 = null;


        CommonTree string_literal66_tree=null;

        try {
            // ttcn3.g:348:2: ( 'return' typeName )
            // ttcn3.g:348:4: 'return' typeName
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal66=(Token)match(input,41,FOLLOW_41_in_returnType876); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal66_tree = (CommonTree)adaptor.create(string_literal66);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal66_tree, root_0);
            }
            pushFollow(FOLLOW_typeName_in_returnType879);
            typeName67=typeName();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, typeName67.getTree());
            if ( state.backtracking==0 ) {
               retval.t = (typeName67!=null?typeName67.t:null); 
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "returnType"

    public static class runsOnSpec_return extends ParserRuleReturnScope {
        public String compName;
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "runsOnSpec"
    // ttcn3.g:351:1: runsOnSpec returns [String compName] : 'runs' 'on' componentType -> ^( RUNS_ON componentType ) ;
    public final ttcn3Parser.runsOnSpec_return runsOnSpec() throws RecognitionException {
        ttcn3Parser.runsOnSpec_return retval = new ttcn3Parser.runsOnSpec_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal68=null;
        Token string_literal69=null;
        ttcn3Parser.componentType_return componentType70 = null;


        CommonTree string_literal68_tree=null;
        CommonTree string_literal69_tree=null;
        RewriteRuleTokenStream stream_43=new RewriteRuleTokenStream(adaptor,"token 43");
        RewriteRuleTokenStream stream_42=new RewriteRuleTokenStream(adaptor,"token 42");
        RewriteRuleSubtreeStream stream_componentType=new RewriteRuleSubtreeStream(adaptor,"rule componentType");
        try {
            // ttcn3.g:352:2: ( 'runs' 'on' componentType -> ^( RUNS_ON componentType ) )
            // ttcn3.g:352:4: 'runs' 'on' componentType
            {
            string_literal68=(Token)match(input,42,FOLLOW_42_in_runsOnSpec895); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_42.add(string_literal68);

            string_literal69=(Token)match(input,43,FOLLOW_43_in_runsOnSpec897); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_43.add(string_literal69);

            pushFollow(FOLLOW_componentType_in_runsOnSpec899);
            componentType70=componentType();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_componentType.add(componentType70.getTree());
            if ( state.backtracking==0 ) {

              			retval.compName = (componentType70!=null?componentType70.name:null);		
              		
            }


            // AST REWRITE
            // elements: componentType
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 356:3: -> ^( RUNS_ON componentType )
            {
                // ttcn3.g:356:6: ^( RUNS_ON componentType )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(RUNS_ON, "RUNS_ON"), root_1);

                adaptor.addChild(root_1, stream_componentType.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "runsOnSpec"

    public static class functionFormalParList_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionFormalParList"
    // ttcn3.g:359:1: functionFormalParList[TType t] : functionFormalPar[t] ( ',' functionFormalPar[t] )* -> ^( FORMAL_ARGS ( functionFormalPar )+ ) ;
    public final ttcn3Parser.functionFormalParList_return functionFormalParList(TType t) throws RecognitionException {
        ttcn3Parser.functionFormalParList_return retval = new ttcn3Parser.functionFormalParList_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal72=null;
        ttcn3Parser.functionFormalPar_return functionFormalPar71 = null;

        ttcn3Parser.functionFormalPar_return functionFormalPar73 = null;


        CommonTree char_literal72_tree=null;
        RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
        RewriteRuleSubtreeStream stream_functionFormalPar=new RewriteRuleSubtreeStream(adaptor,"rule functionFormalPar");
        try {
            // ttcn3.g:360:2: ( functionFormalPar[t] ( ',' functionFormalPar[t] )* -> ^( FORMAL_ARGS ( functionFormalPar )+ ) )
            // ttcn3.g:360:4: functionFormalPar[t] ( ',' functionFormalPar[t] )*
            {
            pushFollow(FOLLOW_functionFormalPar_in_functionFormalParList926);
            functionFormalPar71=functionFormalPar(t);

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_functionFormalPar.add(functionFormalPar71.getTree());
            // ttcn3.g:360:25: ( ',' functionFormalPar[t] )*
            loop20:
            do {
                int alt20=2;
                int LA20_0 = input.LA(1);

                if ( (LA20_0==31) ) {
                    alt20=1;
                }


                switch (alt20) {
            	case 1 :
            	    // ttcn3.g:360:26: ',' functionFormalPar[t]
            	    {
            	    char_literal72=(Token)match(input,31,FOLLOW_31_in_functionFormalParList930); if (state.failed) return retval; 
            	    if ( state.backtracking==0 ) stream_31.add(char_literal72);

            	    pushFollow(FOLLOW_functionFormalPar_in_functionFormalParList932);
            	    functionFormalPar73=functionFormalPar(t);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_functionFormalPar.add(functionFormalPar73.getTree());

            	    }
            	    break;

            	default :
            	    break loop20;
                }
            } while (true);



            // AST REWRITE
            // elements: functionFormalPar
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 361:3: -> ^( FORMAL_ARGS ( functionFormalPar )+ )
            {
                // ttcn3.g:361:6: ^( FORMAL_ARGS ( functionFormalPar )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FORMAL_ARGS, "FORMAL_ARGS"), root_1);

                if ( !(stream_functionFormalPar.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_functionFormalPar.hasNext() ) {
                    adaptor.addChild(root_1, stream_functionFormalPar.nextTree());

                }
                stream_functionFormalPar.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionFormalParList"

    public static class functionFormalPar_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionFormalPar"
    // ttcn3.g:364:1: functionFormalPar[TType t] : formalValuePar[t] ;
    public final ttcn3Parser.functionFormalPar_return functionFormalPar(TType t) throws RecognitionException {
        ttcn3Parser.functionFormalPar_return retval = new ttcn3Parser.functionFormalPar_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.formalValuePar_return formalValuePar74 = null;



        try {
            // ttcn3.g:365:2: ( formalValuePar[t] )
            // ttcn3.g:365:4: formalValuePar[t]
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_formalValuePar_in_functionFormalPar959);
            formalValuePar74=formalValuePar(t);

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, formalValuePar74.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionFormalPar"

    public static class formalValuePar_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "formalValuePar"
    // ttcn3.g:371:1: formalValuePar[TType t] : typeName id -> ^( FORMAL_VAR typeName id ) ;
    public final ttcn3Parser.formalValuePar_return formalValuePar(TType t) throws RecognitionException {
        ttcn3Parser.formalValuePar_return retval = new ttcn3Parser.formalValuePar_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.typeName_return typeName75 = null;

        ttcn3Parser.id_return id76 = null;


        RewriteRuleSubtreeStream stream_typeName=new RewriteRuleSubtreeStream(adaptor,"rule typeName");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");
        try {
            // ttcn3.g:372:2: ( typeName id -> ^( FORMAL_VAR typeName id ) )
            // ttcn3.g:372:25: typeName id
            {
            pushFollow(FOLLOW_typeName_in_formalValuePar982);
            typeName75=typeName();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_typeName.add(typeName75.getTree());
            pushFollow(FOLLOW_id_in_formalValuePar984);
            id76=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id76.getTree());
            if ( state.backtracking==0 ) {

              	            TType type = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((id76!=null?id76.token:null), TAttrib.VALUE, null);
              	            if(type!=null) {
              	                logError((id76!=null?id76.token:null), "multi-defined symbol.");
                      	   		if(type.getToken()!=null)
                      	   			logError(type.getToken(), "previous defined here.");
              	            } else {
              	                t.addSubTableItem((id76!=null?id76.token:null), ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newValue((id76!=null?id76.token:null), TSubAttribVALUE.VAR, (typeName75!=null?typeName75.t:null)));
              	            }
              	        
            }


            // AST REWRITE
            // elements: id, typeName
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 383:3: -> ^( FORMAL_VAR typeName id )
            {
                // ttcn3.g:383:6: ^( FORMAL_VAR typeName id )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FORMAL_VAR, "FORMAL_VAR"), root_1);

                adaptor.addChild(root_1, stream_typeName.nextTree());
                adaptor.addChild(root_1, stream_id.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "formalValuePar"

    public static class statementBlock_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "statementBlock"
    // ttcn3.g:386:1: statementBlock : lc= '{' ( functionStatementOrDefList )? '}' -> ^( BLOCK[$lc, \"Block\"] ( functionStatementOrDefList )? ) ;
    public final ttcn3Parser.statementBlock_return statementBlock() throws RecognitionException {
        ttcn3Parser.statementBlock_return retval = new ttcn3Parser.statementBlock_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token lc=null;
        Token char_literal78=null;
        ttcn3Parser.functionStatementOrDefList_return functionStatementOrDefList77 = null;


        CommonTree lc_tree=null;
        CommonTree char_literal78_tree=null;
        RewriteRuleTokenStream stream_RCURLY=new RewriteRuleTokenStream(adaptor,"token RCURLY");
        RewriteRuleTokenStream stream_LCURLY=new RewriteRuleTokenStream(adaptor,"token LCURLY");
        RewriteRuleSubtreeStream stream_functionStatementOrDefList=new RewriteRuleSubtreeStream(adaptor,"rule functionStatementOrDefList");
        try {
            // ttcn3.g:387:2: (lc= '{' ( functionStatementOrDefList )? '}' -> ^( BLOCK[$lc, \"Block\"] ( functionStatementOrDefList )? ) )
            // ttcn3.g:387:4: lc= '{' ( functionStatementOrDefList )? '}'
            {
            lc=(Token)match(input,LCURLY,FOLLOW_LCURLY_in_statementBlock1021); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_LCURLY.add(lc);

            // ttcn3.g:387:11: ( functionStatementOrDefList )?
            int alt21=2;
            int LA21_0 = input.LA(1);

            if ( (LA21_0==ID||LA21_0==36||LA21_0==41||(LA21_0>=46 && LA21_0<=47)||(LA21_0>=51 && LA21_0<=53)||(LA21_0>=56 && LA21_0<=58)||LA21_0==60) ) {
                alt21=1;
            }
            switch (alt21) {
                case 1 :
                    // ttcn3.g:0:0: functionStatementOrDefList
                    {
                    pushFollow(FOLLOW_functionStatementOrDefList_in_statementBlock1023);
                    functionStatementOrDefList77=functionStatementOrDefList();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_functionStatementOrDefList.add(functionStatementOrDefList77.getTree());

                    }
                    break;

            }

            char_literal78=(Token)match(input,RCURLY,FOLLOW_RCURLY_in_statementBlock1026); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_RCURLY.add(char_literal78);



            // AST REWRITE
            // elements: functionStatementOrDefList
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 388:3: -> ^( BLOCK[$lc, \"Block\"] ( functionStatementOrDefList )? )
            {
                // ttcn3.g:388:6: ^( BLOCK[$lc, \"Block\"] ( functionStatementOrDefList )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(BLOCK, lc, "Block"), root_1);

                // ttcn3.g:388:28: ( functionStatementOrDefList )?
                if ( stream_functionStatementOrDefList.hasNext() ) {
                    adaptor.addChild(root_1, stream_functionStatementOrDefList.nextTree());

                }
                stream_functionStatementOrDefList.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "statementBlock"

    public static class functionStatementOrDefList_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionStatementOrDefList"
    // ttcn3.g:390:1: functionStatementOrDefList : ( functionStatementOrDef semiColon )+ -> ( functionStatementOrDef )+ ;
    public final ttcn3Parser.functionStatementOrDefList_return functionStatementOrDefList() throws RecognitionException {
        ttcn3Parser.functionStatementOrDefList_return retval = new ttcn3Parser.functionStatementOrDefList_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.functionStatementOrDef_return functionStatementOrDef79 = null;

        ttcn3Parser.semiColon_return semiColon80 = null;


        RewriteRuleSubtreeStream stream_functionStatementOrDef=new RewriteRuleSubtreeStream(adaptor,"rule functionStatementOrDef");
        RewriteRuleSubtreeStream stream_semiColon=new RewriteRuleSubtreeStream(adaptor,"rule semiColon");
        try {
            // ttcn3.g:391:2: ( ( functionStatementOrDef semiColon )+ -> ( functionStatementOrDef )+ )
            // ttcn3.g:391:4: ( functionStatementOrDef semiColon )+
            {
            // ttcn3.g:391:4: ( functionStatementOrDef semiColon )+
            int cnt22=0;
            loop22:
            do {
                int alt22=2;
                int LA22_0 = input.LA(1);

                if ( (LA22_0==ID||LA22_0==36||LA22_0==41||(LA22_0>=46 && LA22_0<=47)||(LA22_0>=51 && LA22_0<=53)||(LA22_0>=56 && LA22_0<=58)||LA22_0==60) ) {
                    alt22=1;
                }


                switch (alt22) {
            	case 1 :
            	    // ttcn3.g:391:5: functionStatementOrDef semiColon
            	    {
            	    pushFollow(FOLLOW_functionStatementOrDef_in_functionStatementOrDefList1050);
            	    functionStatementOrDef79=functionStatementOrDef();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_functionStatementOrDef.add(functionStatementOrDef79.getTree());
            	    pushFollow(FOLLOW_semiColon_in_functionStatementOrDefList1054);
            	    semiColon80=semiColon();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_semiColon.add(semiColon80.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt22 >= 1 ) break loop22;
            	    if (state.backtracking>0) {state.failed=true; return retval;}
                        EarlyExitException eee =
                            new EarlyExitException(22, input);
                        throw eee;
                }
                cnt22++;
            } while (true);



            // AST REWRITE
            // elements: functionStatementOrDef
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 392:3: -> ( functionStatementOrDef )+
            {
                if ( !(stream_functionStatementOrDef.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_functionStatementOrDef.hasNext() ) {
                    adaptor.addChild(root_0, stream_functionStatementOrDef.nextTree());

                }
                stream_functionStatementOrDef.reset();

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionStatementOrDefList"

    public static class functionStatementOrDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionStatementOrDef"
    // ttcn3.g:394:1: functionStatementOrDef : ( functionLocalDef | functionStatement );
    public final ttcn3Parser.functionStatementOrDef_return functionStatementOrDef() throws RecognitionException {
        ttcn3Parser.functionStatementOrDef_return retval = new ttcn3Parser.functionStatementOrDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.functionLocalDef_return functionLocalDef81 = null;

        ttcn3Parser.functionStatement_return functionStatement82 = null;



        try {
            // ttcn3.g:395:2: ( functionLocalDef | functionStatement )
            int alt23=2;
            int LA23_0 = input.LA(1);

            if ( (LA23_0==36||LA23_0==46) ) {
                alt23=1;
            }
            else if ( (LA23_0==ID||LA23_0==41||LA23_0==47||(LA23_0>=51 && LA23_0<=53)||(LA23_0>=56 && LA23_0<=58)||LA23_0==60) ) {
                alt23=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 23, 0, input);

                throw nvae;
            }
            switch (alt23) {
                case 1 :
                    // ttcn3.g:395:4: functionLocalDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_functionLocalDef_in_functionStatementOrDef1074);
                    functionLocalDef81=functionLocalDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, functionLocalDef81.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:396:4: functionStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_functionStatement_in_functionStatementOrDef1079);
                    functionStatement82=functionStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, functionStatement82.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionStatementOrDef"

    public static class functionLocalDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionLocalDef"
    // ttcn3.g:398:1: functionLocalDef : ( constDef | varInstance );
    public final ttcn3Parser.functionLocalDef_return functionLocalDef() throws RecognitionException {
        ttcn3Parser.functionLocalDef_return retval = new ttcn3Parser.functionLocalDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.constDef_return constDef83 = null;

        ttcn3Parser.varInstance_return varInstance84 = null;



        try {
            // ttcn3.g:399:2: ( constDef | varInstance )
            int alt24=2;
            int LA24_0 = input.LA(1);

            if ( (LA24_0==36) ) {
                alt24=1;
            }
            else if ( (LA24_0==46) ) {
                alt24=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 24, 0, input);

                throw nvae;
            }
            switch (alt24) {
                case 1 :
                    // ttcn3.g:399:4: constDef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_constDef_in_functionLocalDef1089);
                    constDef83=constDef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, constDef83.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:400:4: varInstance
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_varInstance_in_functionLocalDef1094);
                    varInstance84=varInstance();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, varInstance84.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionLocalDef"

    public static class testcaseDef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "testcaseDef"
    // ttcn3.g:403:1: testcaseDef : 'testcase' id '(' ( testcaseFormalParList[type] )? ')' runsOnSpec ( systemSpec )? statementBlock ;
    public final ttcn3Parser.testcaseDef_return testcaseDef() throws RecognitionException {
        ttcn3Parser.testcaseDef_return retval = new ttcn3Parser.testcaseDef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal85=null;
        Token char_literal87=null;
        Token char_literal89=null;
        ttcn3Parser.id_return id86 = null;

        ttcn3Parser.testcaseFormalParList_return testcaseFormalParList88 = null;

        ttcn3Parser.runsOnSpec_return runsOnSpec90 = null;

        ttcn3Parser.systemSpec_return systemSpec91 = null;

        ttcn3Parser.statementBlock_return statementBlock92 = null;


        CommonTree string_literal85_tree=null;
        CommonTree char_literal87_tree=null;
        CommonTree char_literal89_tree=null;


        	TType type=null;

        try {
            // ttcn3.g:410:2: ( 'testcase' id '(' ( testcaseFormalParList[type] )? ')' runsOnSpec ( systemSpec )? statementBlock )
            // ttcn3.g:410:4: 'testcase' id '(' ( testcaseFormalParList[type] )? ')' runsOnSpec ( systemSpec )? statementBlock
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal85=(Token)match(input,44,FOLLOW_44_in_testcaseDef1111); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal85_tree = (CommonTree)adaptor.create(string_literal85);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal85_tree, root_0);
            }
            pushFollow(FOLLOW_id_in_testcaseDef1114);
            id86=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, id86.getTree());
            if ( state.backtracking==0 ) {

              		   	 //type = addID2Module(((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl, (id86!=null?id86.token:null), TAttrib.TESTCASE);
              		   	 
              		   	 type = ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.findType((id86!=null?id86.token:null), TAttrib.TESTCASE, null);
              		   	 if(null == type) {
              		   	 	 type=((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.newTestcase((id86!=null?id86.token:null));
              		   	 	 ((ttcn3Module_scope)ttcn3Module_stack.peek()).symtbl.addType((id86!=null?id86.token:null), type);
              		   	} else {
              		   		logError((id86!=null?id86.token:null), "multi-defined symbol.");
              		   		if(type.getToken()!=null)
              		   			logError(type.getToken(), "previous defined here.");
              		   	}
              		 
            }
            char_literal87=(Token)match(input,39,FOLLOW_39_in_testcaseDef1125); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal87_tree = (CommonTree)adaptor.create(char_literal87);
            adaptor.addChild(root_0, char_literal87_tree);
            }
            // ttcn3.g:424:7: ( testcaseFormalParList[type] )?
            int alt25=2;
            int LA25_0 = input.LA(1);

            if ( (LA25_0==ID||(LA25_0>=33 && LA25_0<=35)) ) {
                alt25=1;
            }
            switch (alt25) {
                case 1 :
                    // ttcn3.g:0:0: testcaseFormalParList[type]
                    {
                    pushFollow(FOLLOW_testcaseFormalParList_in_testcaseDef1127);
                    testcaseFormalParList88=testcaseFormalParList(type);

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, testcaseFormalParList88.getTree());

                    }
                    break;

            }

            char_literal89=(Token)match(input,40,FOLLOW_40_in_testcaseDef1131); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal89_tree = (CommonTree)adaptor.create(char_literal89);
            adaptor.addChild(root_0, char_literal89_tree);
            }
            pushFollow(FOLLOW_runsOnSpec_in_testcaseDef1135);
            runsOnSpec90=runsOnSpec();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, runsOnSpec90.getTree());
            // ttcn3.g:424:66: ( systemSpec )?
            int alt26=2;
            int LA26_0 = input.LA(1);

            if ( (LA26_0==45) ) {
                alt26=1;
            }
            switch (alt26) {
                case 1 :
                    // ttcn3.g:0:0: systemSpec
                    {
                    pushFollow(FOLLOW_systemSpec_in_testcaseDef1137);
                    systemSpec91=systemSpec();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, systemSpec91.getTree());

                    }
                    break;

            }

            pushFollow(FOLLOW_statementBlock_in_testcaseDef1140);
            statementBlock92=statementBlock();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, statementBlock92.getTree());
            if ( state.backtracking==0 ) {

              	   		((TestcaseType)type).setRunsOnComp((runsOnSpec90!=null?runsOnSpec90.compName:null));
              			if((systemSpec91!=null?systemSpec91.systemCompName:null)!=null) {
              		   		//System.out.print("case:"+(id86!=null?id86.text:null)+" runs on "+(runsOnSpec90!=null?runsOnSpec90.compName:null)+" system on "+(systemSpec91!=null?systemSpec91.systemCompName:null));
              		   		((TestcaseType)type).setSystemOnComp((systemSpec91!=null?systemSpec91.systemCompName:null));
              		   	} else {
              		   		//System.out.print("case:"+(id86!=null?id86.text:null)+" runs on "+(runsOnSpec90!=null?runsOnSpec90.compName:null));
              		   	}
              		
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "testcaseDef"

    public static class systemSpec_return extends ParserRuleReturnScope {
        public String systemCompName;
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "systemSpec"
    // ttcn3.g:439:1: systemSpec returns [String systemCompName] : 'system' id ;
    public final ttcn3Parser.systemSpec_return systemSpec() throws RecognitionException {
        ttcn3Parser.systemSpec_return retval = new ttcn3Parser.systemSpec_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal93=null;
        ttcn3Parser.id_return id94 = null;


        CommonTree string_literal93_tree=null;

        try {
            // ttcn3.g:440:2: ( 'system' id )
            // ttcn3.g:440:4: 'system' id
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal93=(Token)match(input,45,FOLLOW_45_in_systemSpec1159); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal93_tree = (CommonTree)adaptor.create(string_literal93);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal93_tree, root_0);
            }
            pushFollow(FOLLOW_id_in_systemSpec1162);
            id94=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, id94.getTree());
            if ( state.backtracking==0 ) {
              retval.systemCompName = (id94!=null?id94.text:null);
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "systemSpec"

    public static class testcaseFormalParList_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "testcaseFormalParList"
    // ttcn3.g:442:1: testcaseFormalParList[TType t] : testcaseFormalPar[t] ( ',' testcaseFormalPar[t] )* -> ^( FORMAL_ARGS ( testcaseFormalPar )+ ) ;
    public final ttcn3Parser.testcaseFormalParList_return testcaseFormalParList(TType t) throws RecognitionException {
        ttcn3Parser.testcaseFormalParList_return retval = new ttcn3Parser.testcaseFormalParList_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal96=null;
        ttcn3Parser.testcaseFormalPar_return testcaseFormalPar95 = null;

        ttcn3Parser.testcaseFormalPar_return testcaseFormalPar97 = null;


        CommonTree char_literal96_tree=null;
        RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
        RewriteRuleSubtreeStream stream_testcaseFormalPar=new RewriteRuleSubtreeStream(adaptor,"rule testcaseFormalPar");
        try {
            // ttcn3.g:443:2: ( testcaseFormalPar[t] ( ',' testcaseFormalPar[t] )* -> ^( FORMAL_ARGS ( testcaseFormalPar )+ ) )
            // ttcn3.g:443:4: testcaseFormalPar[t] ( ',' testcaseFormalPar[t] )*
            {
            pushFollow(FOLLOW_testcaseFormalPar_in_testcaseFormalParList1176);
            testcaseFormalPar95=testcaseFormalPar(t);

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_testcaseFormalPar.add(testcaseFormalPar95.getTree());
            // ttcn3.g:443:25: ( ',' testcaseFormalPar[t] )*
            loop27:
            do {
                int alt27=2;
                int LA27_0 = input.LA(1);

                if ( (LA27_0==31) ) {
                    alt27=1;
                }


                switch (alt27) {
            	case 1 :
            	    // ttcn3.g:443:26: ',' testcaseFormalPar[t]
            	    {
            	    char_literal96=(Token)match(input,31,FOLLOW_31_in_testcaseFormalParList1180); if (state.failed) return retval; 
            	    if ( state.backtracking==0 ) stream_31.add(char_literal96);

            	    pushFollow(FOLLOW_testcaseFormalPar_in_testcaseFormalParList1182);
            	    testcaseFormalPar97=testcaseFormalPar(t);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_testcaseFormalPar.add(testcaseFormalPar97.getTree());

            	    }
            	    break;

            	default :
            	    break loop27;
                }
            } while (true);



            // AST REWRITE
            // elements: testcaseFormalPar
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 444:3: -> ^( FORMAL_ARGS ( testcaseFormalPar )+ )
            {
                // ttcn3.g:444:6: ^( FORMAL_ARGS ( testcaseFormalPar )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FORMAL_ARGS, "FORMAL_ARGS"), root_1);

                if ( !(stream_testcaseFormalPar.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_testcaseFormalPar.hasNext() ) {
                    adaptor.addChild(root_1, stream_testcaseFormalPar.nextTree());

                }
                stream_testcaseFormalPar.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "testcaseFormalParList"

    public static class testcaseFormalPar_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "testcaseFormalPar"
    // ttcn3.g:446:1: testcaseFormalPar[TType t] : formalValuePar[t] ;
    public final ttcn3Parser.testcaseFormalPar_return testcaseFormalPar(TType t) throws RecognitionException {
        ttcn3Parser.testcaseFormalPar_return retval = new ttcn3Parser.testcaseFormalPar_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.formalValuePar_return formalValuePar98 = null;



        try {
            // ttcn3.g:447:2: ( formalValuePar[t] )
            // ttcn3.g:447:4: formalValuePar[t]
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_formalValuePar_in_testcaseFormalPar1207);
            formalValuePar98=formalValuePar(t);

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, formalValuePar98.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "testcaseFormalPar"

    public static class varInstance_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "varInstance"
    // ttcn3.g:451:1: varInstance : 'var' typeName var[t] ( ',' var[t] )* -> ^( 'var' typeName ( var )+ ) ;
    public final ttcn3Parser.varInstance_return varInstance() throws RecognitionException {
        ttcn3Parser.varInstance_return retval = new ttcn3Parser.varInstance_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal99=null;
        Token char_literal102=null;
        ttcn3Parser.typeName_return typeName100 = null;

        ttcn3Parser.var_return var101 = null;

        ttcn3Parser.var_return var103 = null;


        CommonTree string_literal99_tree=null;
        CommonTree char_literal102_tree=null;
        RewriteRuleTokenStream stream_46=new RewriteRuleTokenStream(adaptor,"token 46");
        RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
        RewriteRuleSubtreeStream stream_var=new RewriteRuleSubtreeStream(adaptor,"rule var");
        RewriteRuleSubtreeStream stream_typeName=new RewriteRuleSubtreeStream(adaptor,"rule typeName");

         TType t=null;
         gidType=null;
         gidToken=null;

        try {
            // ttcn3.g:461:2: ( 'var' typeName var[t] ( ',' var[t] )* -> ^( 'var' typeName ( var )+ ) )
            // ttcn3.g:461:4: 'var' typeName var[t] ( ',' var[t] )*
            {
            string_literal99=(Token)match(input,46,FOLLOW_46_in_varInstance1229); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_46.add(string_literal99);

            pushFollow(FOLLOW_typeName_in_varInstance1231);
            typeName100=typeName();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_typeName.add(typeName100.getTree());
            if ( state.backtracking==0 ) {
              t = (typeName100!=null?typeName100.t:null);
            }
            pushFollow(FOLLOW_var_in_varInstance1236);
            var101=var(t);

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_var.add(var101.getTree());
            // ttcn3.g:461:46: ( ',' var[t] )*
            loop28:
            do {
                int alt28=2;
                int LA28_0 = input.LA(1);

                if ( (LA28_0==31) ) {
                    alt28=1;
                }


                switch (alt28) {
            	case 1 :
            	    // ttcn3.g:461:47: ',' var[t]
            	    {
            	    char_literal102=(Token)match(input,31,FOLLOW_31_in_varInstance1240); if (state.failed) return retval; 
            	    if ( state.backtracking==0 ) stream_31.add(char_literal102);

            	    pushFollow(FOLLOW_var_in_varInstance1242);
            	    var103=var(t);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_var.add(var103.getTree());

            	    }
            	    break;

            	default :
            	    break loop28;
                }
            } while (true);



            // AST REWRITE
            // elements: typeName, 46, var
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 462:3: -> ^( 'var' typeName ( var )+ )
            {
                // ttcn3.g:462:6: ^( 'var' typeName ( var )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_46.nextNode(), root_1);

                adaptor.addChild(root_1, stream_typeName.nextTree());
                if ( !(stream_var.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_var.hasNext() ) {
                    adaptor.addChild(root_1, stream_var.nextTree());

                }
                stream_var.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
            if ( state.backtracking==0 ) {

              // gidType=null;
              // gidToken=null;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "varInstance"

    public static class var_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "var"
    // ttcn3.g:466:1: var[TType t] : ( id | id ':=' expr );
    public final ttcn3Parser.var_return var(TType t) throws RecognitionException {
        ttcn3Parser.var_return retval = new ttcn3Parser.var_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal106=null;
        ttcn3Parser.id_return id104 = null;

        ttcn3Parser.id_return id105 = null;

        ttcn3Parser.expr_return expr107 = null;


        CommonTree string_literal106_tree=null;

        try {
            // ttcn3.g:467:6: ( id | id ':=' expr )
            int alt29=2;
            int LA29_0 = input.LA(1);

            if ( (LA29_0==ID) ) {
                int LA29_1 = input.LA(2);

                if ( (LA29_1==EOF||LA29_1==RCURLY||LA29_1==ID||LA29_1==24||LA29_1==31||LA29_1==36||LA29_1==41||(LA29_1>=46 && LA29_1<=47)||(LA29_1>=51 && LA29_1<=53)||(LA29_1>=56 && LA29_1<=58)||LA29_1==60) ) {
                    alt29=1;
                }
                else if ( (LA29_1==37) ) {
                    alt29=2;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 29, 1, input);

                    throw nvae;
                }
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 29, 0, input);

                throw nvae;
            }
            switch (alt29) {
                case 1 :
                    // ttcn3.g:467:8: id
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_id_in_var1279);
                    id104=id();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, id104.getTree());
                    if ( state.backtracking==0 ) {
                      gidType=t; gidToken=(id104!=null?id104.token:null);
                    }

                    }
                    break;
                case 2 :
                    // ttcn3.g:468:4: id ':=' expr
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_id_in_var1286);
                    id105=id();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, id105.getTree());
                    string_literal106=(Token)match(input,37,FOLLOW_37_in_var1288); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal106_tree = (CommonTree)adaptor.create(string_literal106);
                    root_0 = (CommonTree)adaptor.becomeRoot(string_literal106_tree, root_0);
                    }
                    pushFollow(FOLLOW_expr_in_var1291);
                    expr107=expr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, expr107.getTree());
                    if ( state.backtracking==0 ) {
                      gidType=t; gidToken=(id105!=null?id105.token:null);
                    }

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "var"

    public static class functionStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionStatement"
    // ttcn3.g:471:1: functionStatement : ( basicStatements | behaviourStatements | configurationStatements );
    public final ttcn3Parser.functionStatement_return functionStatement() throws RecognitionException {
        ttcn3Parser.functionStatement_return retval = new ttcn3Parser.functionStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.basicStatements_return basicStatements108 = null;

        ttcn3Parser.behaviourStatements_return behaviourStatements109 = null;

        ttcn3Parser.configurationStatements_return configurationStatements110 = null;



        try {
            // ttcn3.g:472:2: ( basicStatements | behaviourStatements | configurationStatements )
            int alt30=3;
            alt30 = dfa30.predict(input);
            switch (alt30) {
                case 1 :
                    // ttcn3.g:472:4: basicStatements
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_basicStatements_in_functionStatement1305);
                    basicStatements108=basicStatements();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, basicStatements108.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:473:4: behaviourStatements
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_behaviourStatements_in_functionStatement1310);
                    behaviourStatements109=behaviourStatements();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, behaviourStatements109.getTree());

                    }
                    break;
                case 3 :
                    // ttcn3.g:474:4: configurationStatements
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_configurationStatements_in_functionStatement1315);
                    configurationStatements110=configurationStatements();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, configurationStatements110.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionStatement"

    public static class basicStatements_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "basicStatements"
    // ttcn3.g:476:1: basicStatements : ( assignment | logStatement | loopConstruct | conditionalConstruct );
    public final ttcn3Parser.basicStatements_return basicStatements() throws RecognitionException {
        ttcn3Parser.basicStatements_return retval = new ttcn3Parser.basicStatements_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.assignment_return assignment111 = null;

        ttcn3Parser.logStatement_return logStatement112 = null;

        ttcn3Parser.loopConstruct_return loopConstruct113 = null;

        ttcn3Parser.conditionalConstruct_return conditionalConstruct114 = null;



        try {
            // ttcn3.g:477:2: ( assignment | logStatement | loopConstruct | conditionalConstruct )
            int alt31=4;
            switch ( input.LA(1) ) {
            case ID:
                {
                alt31=1;
                }
                break;
            case 60:
                {
                alt31=2;
                }
                break;
            case 57:
                {
                alt31=3;
                }
                break;
            case 58:
                {
                alt31=4;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 31, 0, input);

                throw nvae;
            }

            switch (alt31) {
                case 1 :
                    // ttcn3.g:477:4: assignment
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_assignment_in_basicStatements1325);
                    assignment111=assignment();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment111.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:478:4: logStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_logStatement_in_basicStatements1330);
                    logStatement112=logStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, logStatement112.getTree());

                    }
                    break;
                case 3 :
                    // ttcn3.g:479:4: loopConstruct
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_loopConstruct_in_basicStatements1335);
                    loopConstruct113=loopConstruct();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, loopConstruct113.getTree());

                    }
                    break;
                case 4 :
                    // ttcn3.g:480:4: conditionalConstruct
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_conditionalConstruct_in_basicStatements1340);
                    conditionalConstruct114=conditionalConstruct();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, conditionalConstruct114.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "basicStatements"

    public static class behaviourStatements_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "behaviourStatements"
    // ttcn3.g:483:1: behaviourStatements : ( returnStatement | functionInstance | testcaseInstance );
    public final ttcn3Parser.behaviourStatements_return behaviourStatements() throws RecognitionException {
        ttcn3Parser.behaviourStatements_return retval = new ttcn3Parser.behaviourStatements_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.returnStatement_return returnStatement115 = null;

        ttcn3Parser.functionInstance_return functionInstance116 = null;

        ttcn3Parser.testcaseInstance_return testcaseInstance117 = null;



        try {
            // ttcn3.g:484:2: ( returnStatement | functionInstance | testcaseInstance )
            int alt32=3;
            switch ( input.LA(1) ) {
            case 41:
                {
                alt32=1;
                }
                break;
            case ID:
                {
                alt32=2;
                }
                break;
            case 56:
                {
                alt32=3;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 32, 0, input);

                throw nvae;
            }

            switch (alt32) {
                case 1 :
                    // ttcn3.g:484:4: returnStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_returnStatement_in_behaviourStatements1352);
                    returnStatement115=returnStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, returnStatement115.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:485:4: functionInstance
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_functionInstance_in_behaviourStatements1357);
                    functionInstance116=functionInstance();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, functionInstance116.getTree());

                    }
                    break;
                case 3 :
                    // ttcn3.g:486:4: testcaseInstance
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_testcaseInstance_in_behaviourStatements1362);
                    testcaseInstance117=testcaseInstance();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, testcaseInstance117.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "behaviourStatements"

    public static class configurationStatements_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "configurationStatements"
    // ttcn3.g:489:1: configurationStatements : ( startTCStatement | connectStatement | disconnectStatement | mapStatement | unmapStatement );
    public final ttcn3Parser.configurationStatements_return configurationStatements() throws RecognitionException {
        ttcn3Parser.configurationStatements_return retval = new ttcn3Parser.configurationStatements_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.startTCStatement_return startTCStatement118 = null;

        ttcn3Parser.connectStatement_return connectStatement119 = null;

        ttcn3Parser.disconnectStatement_return disconnectStatement120 = null;

        ttcn3Parser.mapStatement_return mapStatement121 = null;

        ttcn3Parser.unmapStatement_return unmapStatement122 = null;



        try {
            // ttcn3.g:493:2: ( startTCStatement | connectStatement | disconnectStatement | mapStatement | unmapStatement )
            int alt33=5;
            switch ( input.LA(1) ) {
            case ID:
                {
                alt33=1;
                }
                break;
            case 47:
                {
                alt33=2;
                }
                break;
            case 51:
                {
                alt33=3;
                }
                break;
            case 52:
                {
                alt33=4;
                }
                break;
            case 53:
                {
                alt33=5;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 33, 0, input);

                throw nvae;
            }

            switch (alt33) {
                case 1 :
                    // ttcn3.g:493:4: startTCStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_startTCStatement_in_configurationStatements1375);
                    startTCStatement118=startTCStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, startTCStatement118.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:494:4: connectStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_connectStatement_in_configurationStatements1380);
                    connectStatement119=connectStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, connectStatement119.getTree());

                    }
                    break;
                case 3 :
                    // ttcn3.g:495:4: disconnectStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_disconnectStatement_in_configurationStatements1385);
                    disconnectStatement120=disconnectStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, disconnectStatement120.getTree());

                    }
                    break;
                case 4 :
                    // ttcn3.g:496:4: mapStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_mapStatement_in_configurationStatements1390);
                    mapStatement121=mapStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, mapStatement121.getTree());

                    }
                    break;
                case 5 :
                    // ttcn3.g:497:4: unmapStatement
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_unmapStatement_in_configurationStatements1395);
                    unmapStatement122=unmapStatement();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, unmapStatement122.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "configurationStatements"

    public static class connectStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "connectStatement"
    // ttcn3.g:527:1: connectStatement : 'connect' singleConnectionSpec ;
    public final ttcn3Parser.connectStatement_return connectStatement() throws RecognitionException {
        ttcn3Parser.connectStatement_return retval = new ttcn3Parser.connectStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal123=null;
        ttcn3Parser.singleConnectionSpec_return singleConnectionSpec124 = null;


        CommonTree string_literal123_tree=null;

        try {
            // ttcn3.g:528:2: ( 'connect' singleConnectionSpec )
            // ttcn3.g:528:4: 'connect' singleConnectionSpec
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal123=(Token)match(input,47,FOLLOW_47_in_connectStatement1410); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal123_tree = (CommonTree)adaptor.create(string_literal123);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal123_tree, root_0);
            }
            pushFollow(FOLLOW_singleConnectionSpec_in_connectStatement1413);
            singleConnectionSpec124=singleConnectionSpec();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, singleConnectionSpec124.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "connectStatement"

    public static class singleConnectionSpec_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "singleConnectionSpec"
    // ttcn3.g:531:1: singleConnectionSpec : '(' portRef ',' portRef ')' -> ^( SINGLE_CONNECT portRef portRef ) ;
    public final ttcn3Parser.singleConnectionSpec_return singleConnectionSpec() throws RecognitionException {
        ttcn3Parser.singleConnectionSpec_return retval = new ttcn3Parser.singleConnectionSpec_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal125=null;
        Token char_literal127=null;
        Token char_literal129=null;
        ttcn3Parser.portRef_return portRef126 = null;

        ttcn3Parser.portRef_return portRef128 = null;


        CommonTree char_literal125_tree=null;
        CommonTree char_literal127_tree=null;
        CommonTree char_literal129_tree=null;
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_portRef=new RewriteRuleSubtreeStream(adaptor,"rule portRef");
        try {
            // ttcn3.g:532:2: ( '(' portRef ',' portRef ')' -> ^( SINGLE_CONNECT portRef portRef ) )
            // ttcn3.g:532:4: '(' portRef ',' portRef ')'
            {
            char_literal125=(Token)match(input,39,FOLLOW_39_in_singleConnectionSpec1424); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal125);

            pushFollow(FOLLOW_portRef_in_singleConnectionSpec1426);
            portRef126=portRef();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_portRef.add(portRef126.getTree());
            char_literal127=(Token)match(input,31,FOLLOW_31_in_singleConnectionSpec1428); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_31.add(char_literal127);

            pushFollow(FOLLOW_portRef_in_singleConnectionSpec1430);
            portRef128=portRef();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_portRef.add(portRef128.getTree());
            char_literal129=(Token)match(input,40,FOLLOW_40_in_singleConnectionSpec1432); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal129);



            // AST REWRITE
            // elements: portRef, portRef
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 533:3: -> ^( SINGLE_CONNECT portRef portRef )
            {
                // ttcn3.g:533:6: ^( SINGLE_CONNECT portRef portRef )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(SINGLE_CONNECT, "SINGLE_CONNECT"), root_1);

                adaptor.addChild(root_1, stream_portRef.nextTree());
                adaptor.addChild(root_1, stream_portRef.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "singleConnectionSpec"

    public static class portRef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "portRef"
    // ttcn3.g:535:1: portRef : componentRef ':' port -> ^( PORT_REF componentRef port ) ;
    public final ttcn3Parser.portRef_return portRef() throws RecognitionException {
        ttcn3Parser.portRef_return retval = new ttcn3Parser.portRef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal131=null;
        ttcn3Parser.componentRef_return componentRef130 = null;

        ttcn3Parser.port_return port132 = null;


        CommonTree char_literal131_tree=null;
        RewriteRuleTokenStream stream_48=new RewriteRuleTokenStream(adaptor,"token 48");
        RewriteRuleSubtreeStream stream_componentRef=new RewriteRuleSubtreeStream(adaptor,"rule componentRef");
        RewriteRuleSubtreeStream stream_port=new RewriteRuleSubtreeStream(adaptor,"rule port");
        try {
            // ttcn3.g:536:2: ( componentRef ':' port -> ^( PORT_REF componentRef port ) )
            // ttcn3.g:536:4: componentRef ':' port
            {
            pushFollow(FOLLOW_componentRef_in_portRef1454);
            componentRef130=componentRef();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_componentRef.add(componentRef130.getTree());
            char_literal131=(Token)match(input,48,FOLLOW_48_in_portRef1456); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_48.add(char_literal131);

            pushFollow(FOLLOW_port_in_portRef1458);
            port132=port();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_port.add(port132.getTree());


            // AST REWRITE
            // elements: componentRef, port
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 537:3: -> ^( PORT_REF componentRef port )
            {
                // ttcn3.g:537:6: ^( PORT_REF componentRef port )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(PORT_REF, "PORT_REF"), root_1);

                adaptor.addChild(root_1, stream_componentRef.nextTree());
                adaptor.addChild(root_1, stream_port.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "portRef"

    public static class componentRef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "componentRef"
    // ttcn3.g:539:1: componentRef : ( componentOrDefaultReference | 'system' | 'self' | 'mtc' );
    public final ttcn3Parser.componentRef_return componentRef() throws RecognitionException {
        ttcn3Parser.componentRef_return retval = new ttcn3Parser.componentRef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal134=null;
        Token string_literal135=null;
        Token string_literal136=null;
        ttcn3Parser.componentOrDefaultReference_return componentOrDefaultReference133 = null;


        CommonTree string_literal134_tree=null;
        CommonTree string_literal135_tree=null;
        CommonTree string_literal136_tree=null;

        try {
            // ttcn3.g:540:2: ( componentOrDefaultReference | 'system' | 'self' | 'mtc' )
            int alt34=4;
            switch ( input.LA(1) ) {
            case ID:
                {
                alt34=1;
                }
                break;
            case 45:
                {
                alt34=2;
                }
                break;
            case 49:
                {
                alt34=3;
                }
                break;
            case 50:
                {
                alt34=4;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 34, 0, input);

                throw nvae;
            }

            switch (alt34) {
                case 1 :
                    // ttcn3.g:540:4: componentOrDefaultReference
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_componentOrDefaultReference_in_componentRef1480);
                    componentOrDefaultReference133=componentOrDefaultReference();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, componentOrDefaultReference133.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:541:4: 'system'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    string_literal134=(Token)match(input,45,FOLLOW_45_in_componentRef1486); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal134_tree = (CommonTree)adaptor.create(string_literal134);
                    adaptor.addChild(root_0, string_literal134_tree);
                    }

                    }
                    break;
                case 3 :
                    // ttcn3.g:542:4: 'self'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    string_literal135=(Token)match(input,49,FOLLOW_49_in_componentRef1492); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal135_tree = (CommonTree)adaptor.create(string_literal135);
                    adaptor.addChild(root_0, string_literal135_tree);
                    }

                    }
                    break;
                case 4 :
                    // ttcn3.g:543:4: 'mtc'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    string_literal136=(Token)match(input,50,FOLLOW_50_in_componentRef1498); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal136_tree = (CommonTree)adaptor.create(string_literal136);
                    adaptor.addChild(root_0, string_literal136_tree);
                    }

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "componentRef"

    public static class port_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "port"
    // ttcn3.g:545:1: port : portIdentifier ;
    public final ttcn3Parser.port_return port() throws RecognitionException {
        ttcn3Parser.port_return retval = new ttcn3Parser.port_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.portIdentifier_return portIdentifier137 = null;



        try {
            // ttcn3.g:546:2: ( portIdentifier )
            // ttcn3.g:546:4: portIdentifier
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_portIdentifier_in_port1509);
            portIdentifier137=portIdentifier();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, portIdentifier137.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "port"

    public static class portIdentifier_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "portIdentifier"
    // ttcn3.g:549:1: portIdentifier : id ;
    public final ttcn3Parser.portIdentifier_return portIdentifier() throws RecognitionException {
        ttcn3Parser.portIdentifier_return retval = new ttcn3Parser.portIdentifier_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.id_return id138 = null;



        try {
            // ttcn3.g:550:2: ( id )
            // ttcn3.g:550:4: id
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_id_in_portIdentifier1521);
            id138=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, id138.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "portIdentifier"

    public static class disconnectStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "disconnectStatement"
    // ttcn3.g:556:1: disconnectStatement : 'disconnect' ( singleOrMultiConnectionSpec )? ;
    public final ttcn3Parser.disconnectStatement_return disconnectStatement() throws RecognitionException {
        ttcn3Parser.disconnectStatement_return retval = new ttcn3Parser.disconnectStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal139=null;
        ttcn3Parser.singleOrMultiConnectionSpec_return singleOrMultiConnectionSpec140 = null;


        CommonTree string_literal139_tree=null;

        try {
            // ttcn3.g:557:2: ( 'disconnect' ( singleOrMultiConnectionSpec )? )
            // ttcn3.g:557:4: 'disconnect' ( singleOrMultiConnectionSpec )?
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal139=(Token)match(input,51,FOLLOW_51_in_disconnectStatement1535); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal139_tree = (CommonTree)adaptor.create(string_literal139);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal139_tree, root_0);
            }
            // ttcn3.g:557:18: ( singleOrMultiConnectionSpec )?
            int alt35=2;
            int LA35_0 = input.LA(1);

            if ( (LA35_0==39) ) {
                alt35=1;
            }
            switch (alt35) {
                case 1 :
                    // ttcn3.g:557:19: singleOrMultiConnectionSpec
                    {
                    pushFollow(FOLLOW_singleOrMultiConnectionSpec_in_disconnectStatement1539);
                    singleOrMultiConnectionSpec140=singleOrMultiConnectionSpec();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, singleOrMultiConnectionSpec140.getTree());

                    }
                    break;

            }


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "disconnectStatement"

    public static class singleOrMultiConnectionSpec_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "singleOrMultiConnectionSpec"
    // ttcn3.g:559:1: singleOrMultiConnectionSpec : singleConnectionSpec ;
    public final ttcn3Parser.singleOrMultiConnectionSpec_return singleOrMultiConnectionSpec() throws RecognitionException {
        ttcn3Parser.singleOrMultiConnectionSpec_return retval = new ttcn3Parser.singleOrMultiConnectionSpec_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.singleConnectionSpec_return singleConnectionSpec141 = null;



        try {
            // ttcn3.g:560:2: ( singleConnectionSpec )
            // ttcn3.g:560:4: singleConnectionSpec
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_singleConnectionSpec_in_singleOrMultiConnectionSpec1552);
            singleConnectionSpec141=singleConnectionSpec();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, singleConnectionSpec141.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "singleOrMultiConnectionSpec"

    public static class mapStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "mapStatement"
    // ttcn3.g:577:1: mapStatement : 'map' singleConnectionSpec ;
    public final ttcn3Parser.mapStatement_return mapStatement() throws RecognitionException {
        ttcn3Parser.mapStatement_return retval = new ttcn3Parser.mapStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal142=null;
        ttcn3Parser.singleConnectionSpec_return singleConnectionSpec143 = null;


        CommonTree string_literal142_tree=null;

        try {
            // ttcn3.g:578:2: ( 'map' singleConnectionSpec )
            // ttcn3.g:578:4: 'map' singleConnectionSpec
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal142=(Token)match(input,52,FOLLOW_52_in_mapStatement1567); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal142_tree = (CommonTree)adaptor.create(string_literal142);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal142_tree, root_0);
            }
            pushFollow(FOLLOW_singleConnectionSpec_in_mapStatement1570);
            singleConnectionSpec143=singleConnectionSpec();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, singleConnectionSpec143.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "mapStatement"

    public static class unmapStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "unmapStatement"
    // ttcn3.g:581:1: unmapStatement : 'unmap' ( singleOrMultiConnectionSpec )? ;
    public final ttcn3Parser.unmapStatement_return unmapStatement() throws RecognitionException {
        ttcn3Parser.unmapStatement_return retval = new ttcn3Parser.unmapStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal144=null;
        ttcn3Parser.singleOrMultiConnectionSpec_return singleOrMultiConnectionSpec145 = null;


        CommonTree string_literal144_tree=null;

        try {
            // ttcn3.g:582:2: ( 'unmap' ( singleOrMultiConnectionSpec )? )
            // ttcn3.g:582:4: 'unmap' ( singleOrMultiConnectionSpec )?
            {
            root_0 = (CommonTree)adaptor.nil();

            string_literal144=(Token)match(input,53,FOLLOW_53_in_unmapStatement1581); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal144_tree = (CommonTree)adaptor.create(string_literal144);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal144_tree, root_0);
            }
            // ttcn3.g:582:13: ( singleOrMultiConnectionSpec )?
            int alt36=2;
            int LA36_0 = input.LA(1);

            if ( (LA36_0==39) ) {
                alt36=1;
            }
            switch (alt36) {
                case 1 :
                    // ttcn3.g:582:14: singleOrMultiConnectionSpec
                    {
                    pushFollow(FOLLOW_singleOrMultiConnectionSpec_in_unmapStatement1585);
                    singleOrMultiConnectionSpec145=singleOrMultiConnectionSpec();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, singleOrMultiConnectionSpec145.getTree());

                    }
                    break;

            }


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "unmapStatement"

    public static class startTCStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "startTCStatement"
    // ttcn3.g:586:1: startTCStatement : componentOrDefaultReference '.' 'start' '(' functionInstance ')' -> ^( 'start' componentOrDefaultReference functionInstance ) ;
    public final ttcn3Parser.startTCStatement_return startTCStatement() throws RecognitionException {
        ttcn3Parser.startTCStatement_return retval = new ttcn3Parser.startTCStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal147=null;
        Token string_literal148=null;
        Token char_literal149=null;
        Token char_literal151=null;
        ttcn3Parser.componentOrDefaultReference_return componentOrDefaultReference146 = null;

        ttcn3Parser.functionInstance_return functionInstance150 = null;


        CommonTree char_literal147_tree=null;
        CommonTree string_literal148_tree=null;
        CommonTree char_literal149_tree=null;
        CommonTree char_literal151_tree=null;
        RewriteRuleTokenStream stream_54=new RewriteRuleTokenStream(adaptor,"token 54");
        RewriteRuleTokenStream stream_55=new RewriteRuleTokenStream(adaptor,"token 55");
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_componentOrDefaultReference=new RewriteRuleSubtreeStream(adaptor,"rule componentOrDefaultReference");
        RewriteRuleSubtreeStream stream_functionInstance=new RewriteRuleSubtreeStream(adaptor,"rule functionInstance");
        try {
            // ttcn3.g:587:2: ( componentOrDefaultReference '.' 'start' '(' functionInstance ')' -> ^( 'start' componentOrDefaultReference functionInstance ) )
            // ttcn3.g:587:4: componentOrDefaultReference '.' 'start' '(' functionInstance ')'
            {
            pushFollow(FOLLOW_componentOrDefaultReference_in_startTCStatement1599);
            componentOrDefaultReference146=componentOrDefaultReference();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_componentOrDefaultReference.add(componentOrDefaultReference146.getTree());
            char_literal147=(Token)match(input,54,FOLLOW_54_in_startTCStatement1601); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_54.add(char_literal147);

            string_literal148=(Token)match(input,55,FOLLOW_55_in_startTCStatement1603); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_55.add(string_literal148);

            char_literal149=(Token)match(input,39,FOLLOW_39_in_startTCStatement1605); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal149);

            pushFollow(FOLLOW_functionInstance_in_startTCStatement1607);
            functionInstance150=functionInstance();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_functionInstance.add(functionInstance150.getTree());
            char_literal151=(Token)match(input,40,FOLLOW_40_in_startTCStatement1609); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal151);



            // AST REWRITE
            // elements: componentOrDefaultReference, 55, functionInstance
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 588:3: -> ^( 'start' componentOrDefaultReference functionInstance )
            {
                // ttcn3.g:588:6: ^( 'start' componentOrDefaultReference functionInstance )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_55.nextNode(), root_1);

                adaptor.addChild(root_1, stream_componentOrDefaultReference.nextTree());
                adaptor.addChild(root_1, stream_functionInstance.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "startTCStatement"

    public static class componentOrDefaultReference_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "componentOrDefaultReference"
    // ttcn3.g:590:1: componentOrDefaultReference : variableRef ;
    public final ttcn3Parser.componentOrDefaultReference_return componentOrDefaultReference() throws RecognitionException {
        ttcn3Parser.componentOrDefaultReference_return retval = new ttcn3Parser.componentOrDefaultReference_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.variableRef_return variableRef152 = null;



        try {
            // ttcn3.g:591:2: ( variableRef )
            // ttcn3.g:591:4: variableRef
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_variableRef_in_componentOrDefaultReference1631);
            variableRef152=variableRef();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, variableRef152.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "componentOrDefaultReference"

    public static class testcaseInstance_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "testcaseInstance"
    // ttcn3.g:595:1: testcaseInstance : 'execute' '(' id '(' ( testcaseActualParList )? ')' ')' -> ^( 'execute' id ( testcaseActualParList )? ) ;
    public final ttcn3Parser.testcaseInstance_return testcaseInstance() throws RecognitionException {
        ttcn3Parser.testcaseInstance_return retval = new ttcn3Parser.testcaseInstance_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal153=null;
        Token char_literal154=null;
        Token char_literal156=null;
        Token char_literal158=null;
        Token char_literal159=null;
        ttcn3Parser.id_return id155 = null;

        ttcn3Parser.testcaseActualParList_return testcaseActualParList157 = null;


        CommonTree string_literal153_tree=null;
        CommonTree char_literal154_tree=null;
        CommonTree char_literal156_tree=null;
        CommonTree char_literal158_tree=null;
        CommonTree char_literal159_tree=null;
        RewriteRuleTokenStream stream_56=new RewriteRuleTokenStream(adaptor,"token 56");
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");
        RewriteRuleSubtreeStream stream_testcaseActualParList=new RewriteRuleSubtreeStream(adaptor,"rule testcaseActualParList");
        try {
            // ttcn3.g:596:2: ( 'execute' '(' id '(' ( testcaseActualParList )? ')' ')' -> ^( 'execute' id ( testcaseActualParList )? ) )
            // ttcn3.g:596:4: 'execute' '(' id '(' ( testcaseActualParList )? ')' ')'
            {
            string_literal153=(Token)match(input,56,FOLLOW_56_in_testcaseInstance1644); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_56.add(string_literal153);

            char_literal154=(Token)match(input,39,FOLLOW_39_in_testcaseInstance1646); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal154);

            pushFollow(FOLLOW_id_in_testcaseInstance1648);
            id155=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id155.getTree());
            char_literal156=(Token)match(input,39,FOLLOW_39_in_testcaseInstance1650); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal156);

            // ttcn3.g:596:25: ( testcaseActualParList )?
            int alt37=2;
            int LA37_0 = input.LA(1);

            if ( ((LA37_0>=INT && LA37_0<=ID)||LA37_0==39||(LA37_0>=67 && LA37_0<=68)||(LA37_0>=73 && LA37_0<=74)) ) {
                alt37=1;
            }
            switch (alt37) {
                case 1 :
                    // ttcn3.g:0:0: testcaseActualParList
                    {
                    pushFollow(FOLLOW_testcaseActualParList_in_testcaseInstance1652);
                    testcaseActualParList157=testcaseActualParList();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_testcaseActualParList.add(testcaseActualParList157.getTree());

                    }
                    break;

            }

            char_literal158=(Token)match(input,40,FOLLOW_40_in_testcaseInstance1655); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal158);

            char_literal159=(Token)match(input,40,FOLLOW_40_in_testcaseInstance1659); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal159);



            // AST REWRITE
            // elements: id, 56, testcaseActualParList
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 597:3: -> ^( 'execute' id ( testcaseActualParList )? )
            {
                // ttcn3.g:597:6: ^( 'execute' id ( testcaseActualParList )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_56.nextNode(), root_1);

                adaptor.addChild(root_1, stream_id.nextTree());
                // ttcn3.g:597:21: ( testcaseActualParList )?
                if ( stream_testcaseActualParList.hasNext() ) {
                    adaptor.addChild(root_1, stream_testcaseActualParList.nextTree());

                }
                stream_testcaseActualParList.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "testcaseInstance"

    public static class testcaseActualParList_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "testcaseActualParList"
    // ttcn3.g:599:1: testcaseActualParList : actualArgs ;
    public final ttcn3Parser.testcaseActualParList_return testcaseActualParList() throws RecognitionException {
        ttcn3Parser.testcaseActualParList_return retval = new ttcn3Parser.testcaseActualParList_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.actualArgs_return actualArgs160 = null;



        try {
            // ttcn3.g:600:2: ( actualArgs )
            // ttcn3.g:600:4: actualArgs
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_actualArgs_in_testcaseActualParList1682);
            actualArgs160=actualArgs();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, actualArgs160.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "testcaseActualParList"

    public static class loopConstruct_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "loopConstruct"
    // ttcn3.g:611:1: loopConstruct : 'for' '(' initExpr ';' conditionExpr ';' stepExpr ')' statementBlock -> ^( 'for' initExpr conditionExpr stepExpr statementBlock ) ;
    public final ttcn3Parser.loopConstruct_return loopConstruct() throws RecognitionException {
        ttcn3Parser.loopConstruct_return retval = new ttcn3Parser.loopConstruct_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal161=null;
        Token char_literal162=null;
        Token char_literal164=null;
        Token char_literal166=null;
        Token char_literal168=null;
        ttcn3Parser.initExpr_return initExpr163 = null;

        ttcn3Parser.conditionExpr_return conditionExpr165 = null;

        ttcn3Parser.stepExpr_return stepExpr167 = null;

        ttcn3Parser.statementBlock_return statementBlock169 = null;


        CommonTree string_literal161_tree=null;
        CommonTree char_literal162_tree=null;
        CommonTree char_literal164_tree=null;
        CommonTree char_literal166_tree=null;
        CommonTree char_literal168_tree=null;
        RewriteRuleTokenStream stream_57=new RewriteRuleTokenStream(adaptor,"token 57");
        RewriteRuleTokenStream stream_24=new RewriteRuleTokenStream(adaptor,"token 24");
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_initExpr=new RewriteRuleSubtreeStream(adaptor,"rule initExpr");
        RewriteRuleSubtreeStream stream_statementBlock=new RewriteRuleSubtreeStream(adaptor,"rule statementBlock");
        RewriteRuleSubtreeStream stream_conditionExpr=new RewriteRuleSubtreeStream(adaptor,"rule conditionExpr");
        RewriteRuleSubtreeStream stream_stepExpr=new RewriteRuleSubtreeStream(adaptor,"rule stepExpr");
        try {
            // ttcn3.g:612:2: ( 'for' '(' initExpr ';' conditionExpr ';' stepExpr ')' statementBlock -> ^( 'for' initExpr conditionExpr stepExpr statementBlock ) )
            // ttcn3.g:612:4: 'for' '(' initExpr ';' conditionExpr ';' stepExpr ')' statementBlock
            {
            string_literal161=(Token)match(input,57,FOLLOW_57_in_loopConstruct1694); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_57.add(string_literal161);

            char_literal162=(Token)match(input,39,FOLLOW_39_in_loopConstruct1696); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal162);

            pushFollow(FOLLOW_initExpr_in_loopConstruct1698);
            initExpr163=initExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_initExpr.add(initExpr163.getTree());
            char_literal164=(Token)match(input,24,FOLLOW_24_in_loopConstruct1700); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_24.add(char_literal164);

            pushFollow(FOLLOW_conditionExpr_in_loopConstruct1702);
            conditionExpr165=conditionExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_conditionExpr.add(conditionExpr165.getTree());
            char_literal166=(Token)match(input,24,FOLLOW_24_in_loopConstruct1704); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_24.add(char_literal166);

            pushFollow(FOLLOW_stepExpr_in_loopConstruct1706);
            stepExpr167=stepExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_stepExpr.add(stepExpr167.getTree());
            char_literal168=(Token)match(input,40,FOLLOW_40_in_loopConstruct1708); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal168);

            pushFollow(FOLLOW_statementBlock_in_loopConstruct1710);
            statementBlock169=statementBlock();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_statementBlock.add(statementBlock169.getTree());


            // AST REWRITE
            // elements: 57, conditionExpr, statementBlock, initExpr, stepExpr
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 613:3: -> ^( 'for' initExpr conditionExpr stepExpr statementBlock )
            {
                // ttcn3.g:613:6: ^( 'for' initExpr conditionExpr stepExpr statementBlock )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_57.nextNode(), root_1);

                adaptor.addChild(root_1, stream_initExpr.nextTree());
                adaptor.addChild(root_1, stream_conditionExpr.nextTree());
                adaptor.addChild(root_1, stream_stepExpr.nextTree());
                adaptor.addChild(root_1, stream_statementBlock.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "loopConstruct"

    public static class initExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "initExpr"
    // ttcn3.g:615:1: initExpr : ( varInstance | assignment );
    public final ttcn3Parser.initExpr_return initExpr() throws RecognitionException {
        ttcn3Parser.initExpr_return retval = new ttcn3Parser.initExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.varInstance_return varInstance170 = null;

        ttcn3Parser.assignment_return assignment171 = null;



        try {
            // ttcn3.g:616:2: ( varInstance | assignment )
            int alt38=2;
            int LA38_0 = input.LA(1);

            if ( (LA38_0==46) ) {
                alt38=1;
            }
            else if ( (LA38_0==ID) ) {
                alt38=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 38, 0, input);

                throw nvae;
            }
            switch (alt38) {
                case 1 :
                    // ttcn3.g:616:4: varInstance
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_varInstance_in_initExpr1736);
                    varInstance170=varInstance();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, varInstance170.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:617:4: assignment
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_assignment_in_initExpr1741);
                    assignment171=assignment();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment171.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "initExpr"

    public static class conditionExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "conditionExpr"
    // ttcn3.g:619:1: conditionExpr : boolExpr ;
    public final ttcn3Parser.conditionExpr_return conditionExpr() throws RecognitionException {
        ttcn3Parser.conditionExpr_return retval = new ttcn3Parser.conditionExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.boolExpr_return boolExpr172 = null;



        try {
            // ttcn3.g:620:2: ( boolExpr )
            // ttcn3.g:620:4: boolExpr
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_boolExpr_in_conditionExpr1751);
            boolExpr172=boolExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, boolExpr172.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "conditionExpr"

    public static class stepExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "stepExpr"
    // ttcn3.g:622:1: stepExpr : assignment ;
    public final ttcn3Parser.stepExpr_return stepExpr() throws RecognitionException {
        ttcn3Parser.stepExpr_return retval = new ttcn3Parser.stepExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.assignment_return assignment173 = null;



        try {
            // ttcn3.g:623:2: ( assignment )
            // ttcn3.g:623:4: assignment
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_assignment_in_stepExpr1761);
            assignment173=assignment();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment173.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "stepExpr"

    public static class conditionalConstruct_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "conditionalConstruct"
    // ttcn3.g:626:1: conditionalConstruct : 'if' '(' boolExpr ')' s1= statementBlock ( 'else' s2= statementBlock -> ^( 'if' boolExpr $s1 $s2) | -> ^( 'if' boolExpr $s1) ) ;
    public final ttcn3Parser.conditionalConstruct_return conditionalConstruct() throws RecognitionException {
        ttcn3Parser.conditionalConstruct_return retval = new ttcn3Parser.conditionalConstruct_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal174=null;
        Token char_literal175=null;
        Token char_literal177=null;
        Token string_literal178=null;
        ttcn3Parser.statementBlock_return s1 = null;

        ttcn3Parser.statementBlock_return s2 = null;

        ttcn3Parser.boolExpr_return boolExpr176 = null;


        CommonTree string_literal174_tree=null;
        CommonTree char_literal175_tree=null;
        CommonTree char_literal177_tree=null;
        CommonTree string_literal178_tree=null;
        RewriteRuleTokenStream stream_59=new RewriteRuleTokenStream(adaptor,"token 59");
        RewriteRuleTokenStream stream_58=new RewriteRuleTokenStream(adaptor,"token 58");
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_statementBlock=new RewriteRuleSubtreeStream(adaptor,"rule statementBlock");
        RewriteRuleSubtreeStream stream_boolExpr=new RewriteRuleSubtreeStream(adaptor,"rule boolExpr");
        try {
            // ttcn3.g:627:2: ( 'if' '(' boolExpr ')' s1= statementBlock ( 'else' s2= statementBlock -> ^( 'if' boolExpr $s1 $s2) | -> ^( 'if' boolExpr $s1) ) )
            // ttcn3.g:627:4: 'if' '(' boolExpr ')' s1= statementBlock ( 'else' s2= statementBlock -> ^( 'if' boolExpr $s1 $s2) | -> ^( 'if' boolExpr $s1) )
            {
            string_literal174=(Token)match(input,58,FOLLOW_58_in_conditionalConstruct1772); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_58.add(string_literal174);

            char_literal175=(Token)match(input,39,FOLLOW_39_in_conditionalConstruct1774); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal175);

            pushFollow(FOLLOW_boolExpr_in_conditionalConstruct1776);
            boolExpr176=boolExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_boolExpr.add(boolExpr176.getTree());
            char_literal177=(Token)match(input,40,FOLLOW_40_in_conditionalConstruct1778); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal177);

            pushFollow(FOLLOW_statementBlock_in_conditionalConstruct1782);
            s1=statementBlock();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_statementBlock.add(s1.getTree());
            // ttcn3.g:628:3: ( 'else' s2= statementBlock -> ^( 'if' boolExpr $s1 $s2) | -> ^( 'if' boolExpr $s1) )
            int alt39=2;
            int LA39_0 = input.LA(1);

            if ( (LA39_0==59) ) {
                alt39=1;
            }
            else if ( (LA39_0==EOF||LA39_0==RCURLY||LA39_0==ID||(LA39_0>=24 && LA39_0<=26)||LA39_0==29||LA39_0==36||LA39_0==38||LA39_0==41||LA39_0==44||(LA39_0>=46 && LA39_0<=47)||(LA39_0>=51 && LA39_0<=53)||(LA39_0>=56 && LA39_0<=58)||LA39_0==60) ) {
                alt39=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 39, 0, input);

                throw nvae;
            }
            switch (alt39) {
                case 1 :
                    // ttcn3.g:629:7: 'else' s2= statementBlock
                    {
                    string_literal178=(Token)match(input,59,FOLLOW_59_in_conditionalConstruct1795); if (state.failed) return retval; 
                    if ( state.backtracking==0 ) stream_59.add(string_literal178);

                    pushFollow(FOLLOW_statementBlock_in_conditionalConstruct1799);
                    s2=statementBlock();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_statementBlock.add(s2.getTree());


                    // AST REWRITE
                    // elements: 58, s2, s1, boolExpr
                    // token labels: 
                    // rule labels: s2, retval, s1
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    if ( state.backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_s2=new RewriteRuleSubtreeStream(adaptor,"rule s2",s2!=null?s2.tree:null);
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
                    RewriteRuleSubtreeStream stream_s1=new RewriteRuleSubtreeStream(adaptor,"rule s1",s1!=null?s1.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 629:32: -> ^( 'if' boolExpr $s1 $s2)
                    {
                        // ttcn3.g:629:35: ^( 'if' boolExpr $s1 $s2)
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot(stream_58.nextNode(), root_1);

                        adaptor.addChild(root_1, stream_boolExpr.nextTree());
                        adaptor.addChild(root_1, stream_s1.nextTree());
                        adaptor.addChild(root_1, stream_s2.nextTree());

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;}
                    }
                    break;
                case 2 :
                    // ttcn3.g:631:18: 
                    {

                    // AST REWRITE
                    // elements: boolExpr, s1, 58
                    // token labels: 
                    // rule labels: retval, s1
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    if ( state.backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
                    RewriteRuleSubtreeStream stream_s1=new RewriteRuleSubtreeStream(adaptor,"rule s1",s1!=null?s1.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 631:18: -> ^( 'if' boolExpr $s1)
                    {
                        // ttcn3.g:631:21: ^( 'if' boolExpr $s1)
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot(stream_58.nextNode(), root_1);

                        adaptor.addChild(root_1, stream_boolExpr.nextTree());
                        adaptor.addChild(root_1, stream_s1.nextTree());

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;}
                    }
                    break;

            }


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "conditionalConstruct"

    public static class logStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "logStatement"
    // ttcn3.g:635:1: logStatement : 'log' '(' ( actualArgs )? ')' -> ^( 'log' ( actualArgs )? ) ;
    public final ttcn3Parser.logStatement_return logStatement() throws RecognitionException {
        ttcn3Parser.logStatement_return retval = new ttcn3Parser.logStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal179=null;
        Token char_literal180=null;
        Token char_literal182=null;
        ttcn3Parser.actualArgs_return actualArgs181 = null;


        CommonTree string_literal179_tree=null;
        CommonTree char_literal180_tree=null;
        CommonTree char_literal182_tree=null;
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_60=new RewriteRuleTokenStream(adaptor,"token 60");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_actualArgs=new RewriteRuleSubtreeStream(adaptor,"rule actualArgs");
        try {
            // ttcn3.g:636:2: ( 'log' '(' ( actualArgs )? ')' -> ^( 'log' ( actualArgs )? ) )
            // ttcn3.g:636:4: 'log' '(' ( actualArgs )? ')'
            {
            string_literal179=(Token)match(input,60,FOLLOW_60_in_logStatement1853); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_60.add(string_literal179);

            char_literal180=(Token)match(input,39,FOLLOW_39_in_logStatement1855); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal180);

            // ttcn3.g:636:14: ( actualArgs )?
            int alt40=2;
            int LA40_0 = input.LA(1);

            if ( ((LA40_0>=INT && LA40_0<=ID)||LA40_0==39||(LA40_0>=67 && LA40_0<=68)||(LA40_0>=73 && LA40_0<=74)) ) {
                alt40=1;
            }
            switch (alt40) {
                case 1 :
                    // ttcn3.g:0:0: actualArgs
                    {
                    pushFollow(FOLLOW_actualArgs_in_logStatement1857);
                    actualArgs181=actualArgs();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_actualArgs.add(actualArgs181.getTree());

                    }
                    break;

            }

            char_literal182=(Token)match(input,40,FOLLOW_40_in_logStatement1860); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal182);



            // AST REWRITE
            // elements: actualArgs, 60
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 637:3: -> ^( 'log' ( actualArgs )? )
            {
                // ttcn3.g:637:6: ^( 'log' ( actualArgs )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_60.nextNode(), root_1);

                // ttcn3.g:637:14: ( actualArgs )?
                if ( stream_actualArgs.hasNext() ) {
                    adaptor.addChild(root_1, stream_actualArgs.nextTree());

                }
                stream_actualArgs.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "logStatement"

    public static class functionInstance_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "functionInstance"
    // ttcn3.g:639:1: functionInstance : id '(' ( actualArgs )? ')' -> ^( FUNC_CALL id ( actualArgs )? ) ;
    public final ttcn3Parser.functionInstance_return functionInstance() throws RecognitionException {
        ttcn3Parser.functionInstance_return retval = new ttcn3Parser.functionInstance_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal184=null;
        Token char_literal186=null;
        ttcn3Parser.id_return id183 = null;

        ttcn3Parser.actualArgs_return actualArgs185 = null;


        CommonTree char_literal184_tree=null;
        CommonTree char_literal186_tree=null;
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_actualArgs=new RewriteRuleSubtreeStream(adaptor,"rule actualArgs");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");
        try {
            // ttcn3.g:640:2: ( id '(' ( actualArgs )? ')' -> ^( FUNC_CALL id ( actualArgs )? ) )
            // ttcn3.g:640:4: id '(' ( actualArgs )? ')'
            {
            pushFollow(FOLLOW_id_in_functionInstance1881);
            id183=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_id.add(id183.getTree());
            char_literal184=(Token)match(input,39,FOLLOW_39_in_functionInstance1883); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_39.add(char_literal184);

            // ttcn3.g:640:11: ( actualArgs )?
            int alt41=2;
            int LA41_0 = input.LA(1);

            if ( ((LA41_0>=INT && LA41_0<=ID)||LA41_0==39||(LA41_0>=67 && LA41_0<=68)||(LA41_0>=73 && LA41_0<=74)) ) {
                alt41=1;
            }
            switch (alt41) {
                case 1 :
                    // ttcn3.g:0:0: actualArgs
                    {
                    pushFollow(FOLLOW_actualArgs_in_functionInstance1885);
                    actualArgs185=actualArgs();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_actualArgs.add(actualArgs185.getTree());

                    }
                    break;

            }

            char_literal186=(Token)match(input,40,FOLLOW_40_in_functionInstance1888); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_40.add(char_literal186);



            // AST REWRITE
            // elements: id, actualArgs
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 641:3: -> ^( FUNC_CALL id ( actualArgs )? )
            {
                // ttcn3.g:641:6: ^( FUNC_CALL id ( actualArgs )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FUNC_CALL, "FUNC_CALL"), root_1);

                adaptor.addChild(root_1, stream_id.nextTree());
                // ttcn3.g:641:21: ( actualArgs )?
                if ( stream_actualArgs.hasNext() ) {
                    adaptor.addChild(root_1, stream_actualArgs.nextTree());

                }
                stream_actualArgs.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionInstance"

    public static class actualArgs_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "actualArgs"
    // ttcn3.g:643:1: actualArgs : expr ( ',' expr )* -> ^( ACTUAL_ARGS ( expr )+ ) ;
    public final ttcn3Parser.actualArgs_return actualArgs() throws RecognitionException {
        ttcn3Parser.actualArgs_return retval = new ttcn3Parser.actualArgs_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal188=null;
        ttcn3Parser.expr_return expr187 = null;

        ttcn3Parser.expr_return expr189 = null;


        CommonTree char_literal188_tree=null;
        RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // ttcn3.g:644:2: ( expr ( ',' expr )* -> ^( ACTUAL_ARGS ( expr )+ ) )
            // ttcn3.g:644:4: expr ( ',' expr )*
            {
            pushFollow(FOLLOW_expr_in_actualArgs1911);
            expr187=expr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_expr.add(expr187.getTree());
            // ttcn3.g:644:9: ( ',' expr )*
            loop42:
            do {
                int alt42=2;
                int LA42_0 = input.LA(1);

                if ( (LA42_0==31) ) {
                    alt42=1;
                }


                switch (alt42) {
            	case 1 :
            	    // ttcn3.g:644:10: ',' expr
            	    {
            	    char_literal188=(Token)match(input,31,FOLLOW_31_in_actualArgs1914); if (state.failed) return retval; 
            	    if ( state.backtracking==0 ) stream_31.add(char_literal188);

            	    pushFollow(FOLLOW_expr_in_actualArgs1916);
            	    expr189=expr();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) stream_expr.add(expr189.getTree());

            	    }
            	    break;

            	default :
            	    break loop42;
                }
            } while (true);



            // AST REWRITE
            // elements: expr
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 645:3: -> ^( ACTUAL_ARGS ( expr )+ )
            {
                // ttcn3.g:645:6: ^( ACTUAL_ARGS ( expr )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ACTUAL_ARGS, "ACTUAL_ARGS"), root_1);

                if ( !(stream_expr.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_expr.hasNext() ) {
                    adaptor.addChild(root_1, stream_expr.nextTree());

                }
                stream_expr.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "actualArgs"

    public static class returnStatement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "returnStatement"
    // ttcn3.g:647:1: returnStatement : 'return' ( expr )? -> ^( 'return' ( expr )? ) ;
    public final ttcn3Parser.returnStatement_return returnStatement() throws RecognitionException {
        ttcn3Parser.returnStatement_return retval = new ttcn3Parser.returnStatement_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal190=null;
        ttcn3Parser.expr_return expr191 = null;


        CommonTree string_literal190_tree=null;
        RewriteRuleTokenStream stream_41=new RewriteRuleTokenStream(adaptor,"token 41");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // ttcn3.g:648:2: ( 'return' ( expr )? -> ^( 'return' ( expr )? ) )
            // ttcn3.g:648:4: 'return' ( expr )?
            {
            string_literal190=(Token)match(input,41,FOLLOW_41_in_returnStatement1939); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_41.add(string_literal190);

            // ttcn3.g:648:13: ( expr )?
            int alt43=2;
            alt43 = dfa43.predict(input);
            switch (alt43) {
                case 1 :
                    // ttcn3.g:0:0: expr
                    {
                    pushFollow(FOLLOW_expr_in_returnStatement1941);
                    expr191=expr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_expr.add(expr191.getTree());

                    }
                    break;

            }



            // AST REWRITE
            // elements: expr, 41
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 648:19: -> ^( 'return' ( expr )? )
            {
                // ttcn3.g:648:22: ^( 'return' ( expr )? )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_41.nextNode(), root_1);

                // ttcn3.g:648:33: ( expr )?
                if ( stream_expr.hasNext() ) {
                    adaptor.addChild(root_1, stream_expr.nextTree());

                }
                stream_expr.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "returnStatement"

    public static class assignment_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "assignment"
    // ttcn3.g:651:1: assignment : variableRef ':=' expr ;
    public final ttcn3Parser.assignment_return assignment() throws RecognitionException {
        ttcn3Parser.assignment_return retval = new ttcn3Parser.assignment_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal193=null;
        ttcn3Parser.variableRef_return variableRef192 = null;

        ttcn3Parser.expr_return expr194 = null;


        CommonTree string_literal193_tree=null;

        try {
            // ttcn3.g:652:2: ( variableRef ':=' expr )
            // ttcn3.g:652:4: variableRef ':=' expr
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_variableRef_in_assignment1962);
            variableRef192=variableRef();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, variableRef192.getTree());
            string_literal193=(Token)match(input,37,FOLLOW_37_in_assignment1964); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal193_tree = (CommonTree)adaptor.create(string_literal193);
            root_0 = (CommonTree)adaptor.becomeRoot(string_literal193_tree, root_0);
            }
            pushFollow(FOLLOW_expr_in_assignment1967);
            expr194=expr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, expr194.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "assignment"

    public static class variableRef_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "variableRef"
    // ttcn3.g:654:1: variableRef : ( id ( '.' id )+ -> ^( FIELD_ACCESS id ( id )+ ) | id );
    public final ttcn3Parser.variableRef_return variableRef() throws RecognitionException {
        ttcn3Parser.variableRef_return retval = new ttcn3Parser.variableRef_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal196=null;
        ttcn3Parser.id_return id195 = null;

        ttcn3Parser.id_return id197 = null;

        ttcn3Parser.id_return id198 = null;


        CommonTree char_literal196_tree=null;
        RewriteRuleTokenStream stream_54=new RewriteRuleTokenStream(adaptor,"token 54");
        RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id");
        try {
            // ttcn3.g:655:2: ( id ( '.' id )+ -> ^( FIELD_ACCESS id ( id )+ ) | id )
            int alt45=2;
            int LA45_0 = input.LA(1);

            if ( (LA45_0==ID) ) {
                int LA45_1 = input.LA(2);

                if ( (LA45_1==54) ) {
                    int LA45_2 = input.LA(3);

                    if ( (LA45_2==55) ) {
                        alt45=2;
                    }
                    else if ( (LA45_2==ID) ) {
                        alt45=1;
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return retval;}
                        NoViableAltException nvae =
                            new NoViableAltException("", 45, 2, input);

                        throw nvae;
                    }
                }
                else if ( (LA45_1==EOF||LA45_1==RCURLY||LA45_1==ID||(LA45_1>=24 && LA45_1<=26)||LA45_1==29||LA45_1==31||(LA45_1>=36 && LA45_1<=38)||(LA45_1>=40 && LA45_1<=41)||LA45_1==44||(LA45_1>=46 && LA45_1<=48)||(LA45_1>=51 && LA45_1<=53)||(LA45_1>=56 && LA45_1<=58)||(LA45_1>=60 && LA45_1<=72)) ) {
                    alt45=2;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 45, 1, input);

                    throw nvae;
                }
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 45, 0, input);

                throw nvae;
            }
            switch (alt45) {
                case 1 :
                    // ttcn3.g:655:4: id ( '.' id )+
                    {
                    pushFollow(FOLLOW_id_in_variableRef1977);
                    id195=id();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_id.add(id195.getTree());
                    // ttcn3.g:655:7: ( '.' id )+
                    int cnt44=0;
                    loop44:
                    do {
                        int alt44=2;
                        int LA44_0 = input.LA(1);

                        if ( (LA44_0==54) ) {
                            int LA44_2 = input.LA(2);

                            if ( (LA44_2==ID) ) {
                                alt44=1;
                            }


                        }


                        switch (alt44) {
                    	case 1 :
                    	    // ttcn3.g:655:8: '.' id
                    	    {
                    	    char_literal196=(Token)match(input,54,FOLLOW_54_in_variableRef1980); if (state.failed) return retval; 
                    	    if ( state.backtracking==0 ) stream_54.add(char_literal196);

                    	    pushFollow(FOLLOW_id_in_variableRef1982);
                    	    id197=id();

                    	    state._fsp--;
                    	    if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) stream_id.add(id197.getTree());

                    	    }
                    	    break;

                    	default :
                    	    if ( cnt44 >= 1 ) break loop44;
                    	    if (state.backtracking>0) {state.failed=true; return retval;}
                                EarlyExitException eee =
                                    new EarlyExitException(44, input);
                                throw eee;
                        }
                        cnt44++;
                    } while (true);



                    // AST REWRITE
                    // elements: id, id
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    if ( state.backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 655:17: -> ^( FIELD_ACCESS id ( id )+ )
                    {
                        // ttcn3.g:655:20: ^( FIELD_ACCESS id ( id )+ )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FIELD_ACCESS, "FIELD_ACCESS"), root_1);

                        adaptor.addChild(root_1, stream_id.nextTree());
                        if ( !(stream_id.hasNext()) ) {
                            throw new RewriteEarlyExitException();
                        }
                        while ( stream_id.hasNext() ) {
                            adaptor.addChild(root_1, stream_id.nextTree());

                        }
                        stream_id.reset();

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;}
                    }
                    break;
                case 2 :
                    // ttcn3.g:656:6: id
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_id_in_variableRef2002);
                    id198=id();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, id198.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "variableRef"

    public static class constExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "constExpr"
    // ttcn3.g:664:1: constExpr : expr ;
    public final ttcn3Parser.constExpr_return constExpr() throws RecognitionException {
        ttcn3Parser.constExpr_return retval = new ttcn3Parser.constExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.expr_return expr199 = null;



        try {
            // ttcn3.g:665:2: ( expr )
            // ttcn3.g:665:4: expr
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_expr_in_constExpr2018);
            expr199=expr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, expr199.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "constExpr"

    public static class boolExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "boolExpr"
    // ttcn3.g:667:1: boolExpr : expr ;
    public final ttcn3Parser.boolExpr_return boolExpr() throws RecognitionException {
        ttcn3Parser.boolExpr_return retval = new ttcn3Parser.boolExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.expr_return expr200 = null;



        try {
            // ttcn3.g:668:2: ( expr )
            // ttcn3.g:668:4: expr
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_expr_in_boolExpr2028);
            expr200=expr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, expr200.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "boolExpr"

    public static class expr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "expr"
    // ttcn3.g:671:1: expr : relExpr ( ( '==' | '!=' ) relExpr )* ;
    public final ttcn3Parser.expr_return expr() throws RecognitionException {
        ttcn3Parser.expr_return retval = new ttcn3Parser.expr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token string_literal202=null;
        Token string_literal203=null;
        ttcn3Parser.relExpr_return relExpr201 = null;

        ttcn3Parser.relExpr_return relExpr204 = null;


        CommonTree string_literal202_tree=null;
        CommonTree string_literal203_tree=null;

        try {
            // ttcn3.g:672:2: ( relExpr ( ( '==' | '!=' ) relExpr )* )
            // ttcn3.g:672:4: relExpr ( ( '==' | '!=' ) relExpr )*
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_relExpr_in_expr2039);
            relExpr201=relExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, relExpr201.getTree());
            // ttcn3.g:672:12: ( ( '==' | '!=' ) relExpr )*
            loop47:
            do {
                int alt47=2;
                int LA47_0 = input.LA(1);

                if ( ((LA47_0>=61 && LA47_0<=62)) ) {
                    alt47=1;
                }


                switch (alt47) {
            	case 1 :
            	    // ttcn3.g:672:14: ( '==' | '!=' ) relExpr
            	    {
            	    // ttcn3.g:672:14: ( '==' | '!=' )
            	    int alt46=2;
            	    int LA46_0 = input.LA(1);

            	    if ( (LA46_0==61) ) {
            	        alt46=1;
            	    }
            	    else if ( (LA46_0==62) ) {
            	        alt46=2;
            	    }
            	    else {
            	        if (state.backtracking>0) {state.failed=true; return retval;}
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 46, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt46) {
            	        case 1 :
            	            // ttcn3.g:672:15: '=='
            	            {
            	            string_literal202=(Token)match(input,61,FOLLOW_61_in_expr2044); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            string_literal202_tree = (CommonTree)adaptor.create(string_literal202);
            	            root_0 = (CommonTree)adaptor.becomeRoot(string_literal202_tree, root_0);
            	            }

            	            }
            	            break;
            	        case 2 :
            	            // ttcn3.g:672:23: '!='
            	            {
            	            string_literal203=(Token)match(input,62,FOLLOW_62_in_expr2049); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            string_literal203_tree = (CommonTree)adaptor.create(string_literal203);
            	            root_0 = (CommonTree)adaptor.becomeRoot(string_literal203_tree, root_0);
            	            }

            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_relExpr_in_expr2054);
            	    relExpr204=relExpr();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, relExpr204.getTree());

            	    }
            	    break;

            	default :
            	    break loop47;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "expr"

    public static class relExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "relExpr"
    // ttcn3.g:674:1: relExpr : addExpr ( ( '<' | '<=' | '>' | '>=' ) addExpr )? ;
    public final ttcn3Parser.relExpr_return relExpr() throws RecognitionException {
        ttcn3Parser.relExpr_return retval = new ttcn3Parser.relExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal206=null;
        Token string_literal207=null;
        Token char_literal208=null;
        Token string_literal209=null;
        ttcn3Parser.addExpr_return addExpr205 = null;

        ttcn3Parser.addExpr_return addExpr210 = null;


        CommonTree char_literal206_tree=null;
        CommonTree string_literal207_tree=null;
        CommonTree char_literal208_tree=null;
        CommonTree string_literal209_tree=null;

        try {
            // ttcn3.g:675:2: ( addExpr ( ( '<' | '<=' | '>' | '>=' ) addExpr )? )
            // ttcn3.g:675:4: addExpr ( ( '<' | '<=' | '>' | '>=' ) addExpr )?
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_addExpr_in_relExpr2066);
            addExpr205=addExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, addExpr205.getTree());
            // ttcn3.g:675:12: ( ( '<' | '<=' | '>' | '>=' ) addExpr )?
            int alt49=2;
            int LA49_0 = input.LA(1);

            if ( ((LA49_0>=63 && LA49_0<=66)) ) {
                alt49=1;
            }
            switch (alt49) {
                case 1 :
                    // ttcn3.g:675:14: ( '<' | '<=' | '>' | '>=' ) addExpr
                    {
                    // ttcn3.g:675:14: ( '<' | '<=' | '>' | '>=' )
                    int alt48=4;
                    switch ( input.LA(1) ) {
                    case 63:
                        {
                        alt48=1;
                        }
                        break;
                    case 64:
                        {
                        alt48=2;
                        }
                        break;
                    case 65:
                        {
                        alt48=3;
                        }
                        break;
                    case 66:
                        {
                        alt48=4;
                        }
                        break;
                    default:
                        if (state.backtracking>0) {state.failed=true; return retval;}
                        NoViableAltException nvae =
                            new NoViableAltException("", 48, 0, input);

                        throw nvae;
                    }

                    switch (alt48) {
                        case 1 :
                            // ttcn3.g:675:15: '<'
                            {
                            char_literal206=(Token)match(input,63,FOLLOW_63_in_relExpr2071); if (state.failed) return retval;
                            if ( state.backtracking==0 ) {
                            char_literal206_tree = (CommonTree)adaptor.create(char_literal206);
                            root_0 = (CommonTree)adaptor.becomeRoot(char_literal206_tree, root_0);
                            }

                            }
                            break;
                        case 2 :
                            // ttcn3.g:675:22: '<='
                            {
                            string_literal207=(Token)match(input,64,FOLLOW_64_in_relExpr2076); if (state.failed) return retval;
                            if ( state.backtracking==0 ) {
                            string_literal207_tree = (CommonTree)adaptor.create(string_literal207);
                            root_0 = (CommonTree)adaptor.becomeRoot(string_literal207_tree, root_0);
                            }

                            }
                            break;
                        case 3 :
                            // ttcn3.g:675:30: '>'
                            {
                            char_literal208=(Token)match(input,65,FOLLOW_65_in_relExpr2081); if (state.failed) return retval;
                            if ( state.backtracking==0 ) {
                            char_literal208_tree = (CommonTree)adaptor.create(char_literal208);
                            root_0 = (CommonTree)adaptor.becomeRoot(char_literal208_tree, root_0);
                            }

                            }
                            break;
                        case 4 :
                            // ttcn3.g:675:37: '>='
                            {
                            string_literal209=(Token)match(input,66,FOLLOW_66_in_relExpr2086); if (state.failed) return retval;
                            if ( state.backtracking==0 ) {
                            string_literal209_tree = (CommonTree)adaptor.create(string_literal209);
                            root_0 = (CommonTree)adaptor.becomeRoot(string_literal209_tree, root_0);
                            }

                            }
                            break;

                    }

                    pushFollow(FOLLOW_addExpr_in_relExpr2090);
                    addExpr210=addExpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, addExpr210.getTree());

                    }
                    break;

            }


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "relExpr"

    public static class addExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "addExpr"
    // ttcn3.g:677:1: addExpr : mulExpr ( ( '+' | '-' | '&' ) mulExpr )* ;
    public final ttcn3Parser.addExpr_return addExpr() throws RecognitionException {
        ttcn3Parser.addExpr_return retval = new ttcn3Parser.addExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal212=null;
        Token char_literal213=null;
        Token char_literal214=null;
        ttcn3Parser.mulExpr_return mulExpr211 = null;

        ttcn3Parser.mulExpr_return mulExpr215 = null;


        CommonTree char_literal212_tree=null;
        CommonTree char_literal213_tree=null;
        CommonTree char_literal214_tree=null;

        try {
            // ttcn3.g:678:2: ( mulExpr ( ( '+' | '-' | '&' ) mulExpr )* )
            // ttcn3.g:678:4: mulExpr ( ( '+' | '-' | '&' ) mulExpr )*
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_mulExpr_in_addExpr2102);
            mulExpr211=mulExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, mulExpr211.getTree());
            // ttcn3.g:678:12: ( ( '+' | '-' | '&' ) mulExpr )*
            loop51:
            do {
                int alt51=2;
                int LA51_0 = input.LA(1);

                if ( ((LA51_0>=67 && LA51_0<=69)) ) {
                    alt51=1;
                }


                switch (alt51) {
            	case 1 :
            	    // ttcn3.g:678:14: ( '+' | '-' | '&' ) mulExpr
            	    {
            	    // ttcn3.g:678:14: ( '+' | '-' | '&' )
            	    int alt50=3;
            	    switch ( input.LA(1) ) {
            	    case 67:
            	        {
            	        alt50=1;
            	        }
            	        break;
            	    case 68:
            	        {
            	        alt50=2;
            	        }
            	        break;
            	    case 69:
            	        {
            	        alt50=3;
            	        }
            	        break;
            	    default:
            	        if (state.backtracking>0) {state.failed=true; return retval;}
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 50, 0, input);

            	        throw nvae;
            	    }

            	    switch (alt50) {
            	        case 1 :
            	            // ttcn3.g:678:15: '+'
            	            {
            	            char_literal212=(Token)match(input,67,FOLLOW_67_in_addExpr2107); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            char_literal212_tree = (CommonTree)adaptor.create(char_literal212);
            	            root_0 = (CommonTree)adaptor.becomeRoot(char_literal212_tree, root_0);
            	            }

            	            }
            	            break;
            	        case 2 :
            	            // ttcn3.g:678:22: '-'
            	            {
            	            char_literal213=(Token)match(input,68,FOLLOW_68_in_addExpr2112); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            char_literal213_tree = (CommonTree)adaptor.create(char_literal213);
            	            root_0 = (CommonTree)adaptor.becomeRoot(char_literal213_tree, root_0);
            	            }

            	            }
            	            break;
            	        case 3 :
            	            // ttcn3.g:678:29: '&'
            	            {
            	            char_literal214=(Token)match(input,69,FOLLOW_69_in_addExpr2117); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            char_literal214_tree = (CommonTree)adaptor.create(char_literal214);
            	            root_0 = (CommonTree)adaptor.becomeRoot(char_literal214_tree, root_0);
            	            }

            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_mulExpr_in_addExpr2122);
            	    mulExpr215=mulExpr();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, mulExpr215.getTree());

            	    }
            	    break;

            	default :
            	    break loop51;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "addExpr"

    public static class mulExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "mulExpr"
    // ttcn3.g:680:1: mulExpr : unaryExpr ( ( '*' | '/' | 'mod' ) unaryExpr )* ;
    public final ttcn3Parser.mulExpr_return mulExpr() throws RecognitionException {
        ttcn3Parser.mulExpr_return retval = new ttcn3Parser.mulExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal217=null;
        Token char_literal218=null;
        Token string_literal219=null;
        ttcn3Parser.unaryExpr_return unaryExpr216 = null;

        ttcn3Parser.unaryExpr_return unaryExpr220 = null;


        CommonTree char_literal217_tree=null;
        CommonTree char_literal218_tree=null;
        CommonTree string_literal219_tree=null;

        try {
            // ttcn3.g:681:2: ( unaryExpr ( ( '*' | '/' | 'mod' ) unaryExpr )* )
            // ttcn3.g:681:4: unaryExpr ( ( '*' | '/' | 'mod' ) unaryExpr )*
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_unaryExpr_in_mulExpr2134);
            unaryExpr216=unaryExpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpr216.getTree());
            // ttcn3.g:681:14: ( ( '*' | '/' | 'mod' ) unaryExpr )*
            loop53:
            do {
                int alt53=2;
                int LA53_0 = input.LA(1);

                if ( ((LA53_0>=70 && LA53_0<=72)) ) {
                    alt53=1;
                }


                switch (alt53) {
            	case 1 :
            	    // ttcn3.g:681:16: ( '*' | '/' | 'mod' ) unaryExpr
            	    {
            	    // ttcn3.g:681:16: ( '*' | '/' | 'mod' )
            	    int alt52=3;
            	    switch ( input.LA(1) ) {
            	    case 70:
            	        {
            	        alt52=1;
            	        }
            	        break;
            	    case 71:
            	        {
            	        alt52=2;
            	        }
            	        break;
            	    case 72:
            	        {
            	        alt52=3;
            	        }
            	        break;
            	    default:
            	        if (state.backtracking>0) {state.failed=true; return retval;}
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 52, 0, input);

            	        throw nvae;
            	    }

            	    switch (alt52) {
            	        case 1 :
            	            // ttcn3.g:681:17: '*'
            	            {
            	            char_literal217=(Token)match(input,70,FOLLOW_70_in_mulExpr2139); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            char_literal217_tree = (CommonTree)adaptor.create(char_literal217);
            	            root_0 = (CommonTree)adaptor.becomeRoot(char_literal217_tree, root_0);
            	            }

            	            }
            	            break;
            	        case 2 :
            	            // ttcn3.g:681:24: '/'
            	            {
            	            char_literal218=(Token)match(input,71,FOLLOW_71_in_mulExpr2144); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            char_literal218_tree = (CommonTree)adaptor.create(char_literal218);
            	            root_0 = (CommonTree)adaptor.becomeRoot(char_literal218_tree, root_0);
            	            }

            	            }
            	            break;
            	        case 3 :
            	            // ttcn3.g:681:31: 'mod'
            	            {
            	            string_literal219=(Token)match(input,72,FOLLOW_72_in_mulExpr2149); if (state.failed) return retval;
            	            if ( state.backtracking==0 ) {
            	            string_literal219_tree = (CommonTree)adaptor.create(string_literal219);
            	            root_0 = (CommonTree)adaptor.becomeRoot(string_literal219_tree, root_0);
            	            }

            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_unaryExpr_in_mulExpr2153);
            	    unaryExpr220=unaryExpr();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpr220.getTree());

            	    }
            	    break;

            	default :
            	    break loop53;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "mulExpr"

    public static class unaryExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "unaryExpr"
    // ttcn3.g:683:1: unaryExpr : ( '-' primary -> ^( UNARY_EXPR '-' primary ) | '+' primary -> ^( UNARY_EXPR '+' primary ) | primary );
    public final ttcn3Parser.unaryExpr_return unaryExpr() throws RecognitionException {
        ttcn3Parser.unaryExpr_return retval = new ttcn3Parser.unaryExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal221=null;
        Token char_literal223=null;
        ttcn3Parser.primary_return primary222 = null;

        ttcn3Parser.primary_return primary224 = null;

        ttcn3Parser.primary_return primary225 = null;


        CommonTree char_literal221_tree=null;
        CommonTree char_literal223_tree=null;
        RewriteRuleTokenStream stream_68=new RewriteRuleTokenStream(adaptor,"token 68");
        RewriteRuleTokenStream stream_67=new RewriteRuleTokenStream(adaptor,"token 67");
        RewriteRuleSubtreeStream stream_primary=new RewriteRuleSubtreeStream(adaptor,"rule primary");
        try {
            // ttcn3.g:684:2: ( '-' primary -> ^( UNARY_EXPR '-' primary ) | '+' primary -> ^( UNARY_EXPR '+' primary ) | primary )
            int alt54=3;
            switch ( input.LA(1) ) {
            case 68:
                {
                alt54=1;
                }
                break;
            case 67:
                {
                alt54=2;
                }
                break;
            case INT:
            case Cstring:
            case ID:
            case 39:
            case 73:
            case 74:
                {
                alt54=3;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 54, 0, input);

                throw nvae;
            }

            switch (alt54) {
                case 1 :
                    // ttcn3.g:684:4: '-' primary
                    {
                    char_literal221=(Token)match(input,68,FOLLOW_68_in_unaryExpr2165); if (state.failed) return retval; 
                    if ( state.backtracking==0 ) stream_68.add(char_literal221);

                    pushFollow(FOLLOW_primary_in_unaryExpr2167);
                    primary222=primary();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_primary.add(primary222.getTree());


                    // AST REWRITE
                    // elements: primary, 68
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    if ( state.backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 684:16: -> ^( UNARY_EXPR '-' primary )
                    {
                        // ttcn3.g:684:19: ^( UNARY_EXPR '-' primary )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPR, "UNARY_EXPR"), root_1);

                        adaptor.addChild(root_1, stream_68.nextNode());
                        adaptor.addChild(root_1, stream_primary.nextTree());

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;}
                    }
                    break;
                case 2 :
                    // ttcn3.g:685:4: '+' primary
                    {
                    char_literal223=(Token)match(input,67,FOLLOW_67_in_unaryExpr2182); if (state.failed) return retval; 
                    if ( state.backtracking==0 ) stream_67.add(char_literal223);

                    pushFollow(FOLLOW_primary_in_unaryExpr2184);
                    primary224=primary();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_primary.add(primary224.getTree());


                    // AST REWRITE
                    // elements: 67, primary
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    if ( state.backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 685:16: -> ^( UNARY_EXPR '+' primary )
                    {
                        // ttcn3.g:685:19: ^( UNARY_EXPR '+' primary )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPR, "UNARY_EXPR"), root_1);

                        adaptor.addChild(root_1, stream_67.nextNode());
                        adaptor.addChild(root_1, stream_primary.nextTree());

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;}
                    }
                    break;
                case 3 :
                    // ttcn3.g:686:4: primary
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_primary_in_unaryExpr2199);
                    primary225=primary();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, primary225.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "unaryExpr"

    public static class primary_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "primary"
    // ttcn3.g:688:1: primary options {k=*; } : ( value | '(' expr ')' -> expr | opCall );
    public final ttcn3Parser.primary_return primary() throws RecognitionException {
        ttcn3Parser.primary_return retval = new ttcn3Parser.primary_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal227=null;
        Token char_literal229=null;
        ttcn3Parser.value_return value226 = null;

        ttcn3Parser.expr_return expr228 = null;

        ttcn3Parser.opCall_return opCall230 = null;


        CommonTree char_literal227_tree=null;
        CommonTree char_literal229_tree=null;
        RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
        RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // ttcn3.g:692:2: ( value | '(' expr ')' -> expr | opCall )
            int alt55=3;
            switch ( input.LA(1) ) {
            case INT:
            case Cstring:
            case 73:
            case 74:
                {
                alt55=1;
                }
                break;
            case ID:
                {
                int LA55_2 = input.LA(2);

                if ( (LA55_2==54) ) {
                    int LA55_4 = input.LA(3);

                    if ( (LA55_4==75) ) {
                        alt55=3;
                    }
                    else if ( (LA55_4==ID) ) {
                        alt55=1;
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return retval;}
                        NoViableAltException nvae =
                            new NoViableAltException("", 55, 4, input);

                        throw nvae;
                    }
                }
                else if ( (LA55_2==EOF||LA55_2==RCURLY||LA55_2==ID||(LA55_2>=24 && LA55_2<=26)||LA55_2==29||LA55_2==31||LA55_2==36||(LA55_2>=38 && LA55_2<=41)||LA55_2==44||(LA55_2>=46 && LA55_2<=47)||(LA55_2>=51 && LA55_2<=53)||(LA55_2>=56 && LA55_2<=58)||(LA55_2>=60 && LA55_2<=72)) ) {
                    alt55=1;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 55, 2, input);

                    throw nvae;
                }
                }
                break;
            case 39:
                {
                alt55=2;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 55, 0, input);

                throw nvae;
            }

            switch (alt55) {
                case 1 :
                    // ttcn3.g:692:4: value
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_value_in_primary2218);
                    value226=value();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, value226.getTree());

                    }
                    break;
                case 2 :
                    // ttcn3.g:693:4: '(' expr ')'
                    {
                    char_literal227=(Token)match(input,39,FOLLOW_39_in_primary2223); if (state.failed) return retval; 
                    if ( state.backtracking==0 ) stream_39.add(char_literal227);

                    pushFollow(FOLLOW_expr_in_primary2225);
                    expr228=expr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) stream_expr.add(expr228.getTree());
                    char_literal229=(Token)match(input,40,FOLLOW_40_in_primary2227); if (state.failed) return retval; 
                    if ( state.backtracking==0 ) stream_40.add(char_literal229);



                    // AST REWRITE
                    // elements: expr
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    if ( state.backtracking==0 ) {
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 693:17: -> expr
                    {
                        adaptor.addChild(root_0, stream_expr.nextTree());

                    }

                    retval.tree = root_0;}
                    }
                    break;
                case 3 :
                    // ttcn3.g:694:4: opCall
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_opCall_in_primary2236);
                    opCall230=opCall();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, opCall230.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "primary"

    public static class value_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "value"
    // ttcn3.g:696:1: value : ( INT | Cstring | ( 'true' | 'false' ) | variableRef | functionInstance );
    public final ttcn3Parser.value_return value() throws RecognitionException {
        ttcn3Parser.value_return retval = new ttcn3Parser.value_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token INT231=null;
        Token Cstring232=null;
        Token set233=null;
        ttcn3Parser.variableRef_return variableRef234 = null;

        ttcn3Parser.functionInstance_return functionInstance235 = null;


        CommonTree INT231_tree=null;
        CommonTree Cstring232_tree=null;
        CommonTree set233_tree=null;

        try {
            // ttcn3.g:697:2: ( INT | Cstring | ( 'true' | 'false' ) | variableRef | functionInstance )
            int alt56=5;
            switch ( input.LA(1) ) {
            case INT:
                {
                alt56=1;
                }
                break;
            case Cstring:
                {
                alt56=2;
                }
                break;
            case 73:
            case 74:
                {
                alt56=3;
                }
                break;
            case ID:
                {
                int LA56_4 = input.LA(2);

                if ( (LA56_4==EOF||LA56_4==RCURLY||LA56_4==ID||(LA56_4>=24 && LA56_4<=26)||LA56_4==29||LA56_4==31||LA56_4==36||LA56_4==38||(LA56_4>=40 && LA56_4<=41)||LA56_4==44||(LA56_4>=46 && LA56_4<=47)||(LA56_4>=51 && LA56_4<=54)||(LA56_4>=56 && LA56_4<=58)||(LA56_4>=60 && LA56_4<=72)) ) {
                    alt56=4;
                }
                else if ( (LA56_4==39) ) {
                    alt56=5;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 56, 4, input);

                    throw nvae;
                }
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 56, 0, input);

                throw nvae;
            }

            switch (alt56) {
                case 1 :
                    // ttcn3.g:697:4: INT
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    INT231=(Token)match(input,INT,FOLLOW_INT_in_value2247); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    INT231_tree = (CommonTree)adaptor.create(INT231);
                    adaptor.addChild(root_0, INT231_tree);
                    }

                    }
                    break;
                case 2 :
                    // ttcn3.g:698:4: Cstring
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    Cstring232=(Token)match(input,Cstring,FOLLOW_Cstring_in_value2254); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    Cstring232_tree = (CommonTree)adaptor.create(Cstring232);
                    adaptor.addChild(root_0, Cstring232_tree);
                    }

                    }
                    break;
                case 3 :
                    // ttcn3.g:699:4: ( 'true' | 'false' )
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    set233=(Token)input.LT(1);
                    if ( (input.LA(1)>=73 && input.LA(1)<=74) ) {
                        input.consume();
                        if ( state.backtracking==0 ) adaptor.addChild(root_0, (CommonTree)adaptor.create(set233));
                        state.errorRecovery=false;state.failed=false;
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return retval;}
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        throw mse;
                    }


                    }
                    break;
                case 4 :
                    // ttcn3.g:700:4: variableRef
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_variableRef_in_value2272);
                    variableRef234=variableRef();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, variableRef234.getTree());

                    }
                    break;
                case 5 :
                    // ttcn3.g:703:9: functionInstance
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_functionInstance_in_value2305);
                    functionInstance235=functionInstance();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, functionInstance235.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "value"

    public static class opCall_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "opCall"
    // ttcn3.g:706:1: opCall : configurationOps ;
    public final ttcn3Parser.opCall_return opCall() throws RecognitionException {
        ttcn3Parser.opCall_return retval = new ttcn3Parser.opCall_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.configurationOps_return configurationOps236 = null;



        try {
            // ttcn3.g:707:2: ( configurationOps )
            // ttcn3.g:707:4: configurationOps
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_configurationOps_in_opCall2316);
            configurationOps236=configurationOps();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, configurationOps236.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "opCall"

    public static class configurationOps_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "configurationOps"
    // ttcn3.g:712:1: configurationOps : createOp ;
    public final ttcn3Parser.configurationOps_return configurationOps() throws RecognitionException {
        ttcn3Parser.configurationOps_return retval = new ttcn3Parser.configurationOps_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.createOp_return createOp237 = null;



        try {
            // ttcn3.g:713:2: ( createOp )
            // ttcn3.g:713:4: createOp
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_createOp_in_configurationOps2332);
            createOp237=createOp();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, createOp237.getTree());

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "configurationOps"

    public static class createOp_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "createOp"
    // ttcn3.g:720:1: createOp : componentType '.' 'create' -> ^( 'create' componentType ) ;
    public final ttcn3Parser.createOp_return createOp() throws RecognitionException {
        ttcn3Parser.createOp_return retval = new ttcn3Parser.createOp_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal239=null;
        Token string_literal240=null;
        ttcn3Parser.componentType_return componentType238 = null;


        CommonTree char_literal239_tree=null;
        CommonTree string_literal240_tree=null;
        RewriteRuleTokenStream stream_54=new RewriteRuleTokenStream(adaptor,"token 54");
        RewriteRuleTokenStream stream_75=new RewriteRuleTokenStream(adaptor,"token 75");
        RewriteRuleSubtreeStream stream_componentType=new RewriteRuleSubtreeStream(adaptor,"rule componentType");
        try {
            // ttcn3.g:721:2: ( componentType '.' 'create' -> ^( 'create' componentType ) )
            // ttcn3.g:721:4: componentType '.' 'create'
            {
            pushFollow(FOLLOW_componentType_in_createOp2349);
            componentType238=componentType();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) stream_componentType.add(componentType238.getTree());
            char_literal239=(Token)match(input,54,FOLLOW_54_in_createOp2351); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_54.add(char_literal239);

            string_literal240=(Token)match(input,75,FOLLOW_75_in_createOp2353); if (state.failed) return retval; 
            if ( state.backtracking==0 ) stream_75.add(string_literal240);



            // AST REWRITE
            // elements: 75, componentType
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            if ( state.backtracking==0 ) {
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 722:3: -> ^( 'create' componentType )
            {
                // ttcn3.g:722:5: ^( 'create' componentType )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_75.nextNode(), root_1);

                adaptor.addChild(root_1, stream_componentType.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;}
            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "createOp"

    public static class componentType_return extends ParserRuleReturnScope {
        public String name;
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "componentType"
    // ttcn3.g:724:1: componentType returns [String name] : id ;
    public final ttcn3Parser.componentType_return componentType() throws RecognitionException {
        ttcn3Parser.componentType_return retval = new ttcn3Parser.componentType_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        ttcn3Parser.id_return id241 = null;



        try {
            // ttcn3.g:725:2: ( id )
            // ttcn3.g:725:4: id
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_id_in_componentType2376);
            id241=id();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, id241.getTree());
            if ( state.backtracking==0 ) {
              retval.name =(id241!=null?id241.text:null);
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "componentType"

    public static class id_return extends ParserRuleReturnScope {
        public Token token;
        public String text;
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "id"
    // ttcn3.g:729:1: id returns [Token token, String text] : ID ;
    public final ttcn3Parser.id_return id() throws RecognitionException {
        ttcn3Parser.id_return retval = new ttcn3Parser.id_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID242=null;

        CommonTree ID242_tree=null;

        try {
            // ttcn3.g:730:5: ( ID )
            // ttcn3.g:730:9: ID
            {
            root_0 = (CommonTree)adaptor.nil();

            ID242=(Token)match(input,ID,FOLLOW_ID_in_id2398); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID242_tree = (CommonTree)adaptor.create(ID242);
            adaptor.addChild(root_0, ID242_tree);
            }
            if ( state.backtracking==0 ) {

                          retval.token = ID242;
                          retval.token.setText((ID242!=null?ID242.getText():null)+"_");
                          retval.text = retval.token.getText();
                      
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "id"

    // $ANTLR start synpred5_ttcn3
    public final void synpred5_ttcn3_fragment() throws RecognitionException {   
        // ttcn3.g:114:6: ( ';' )
        // ttcn3.g:114:6: ';'
        {
        match(input,24,FOLLOW_24_in_synpred5_ttcn3235); if (state.failed) return ;

        }
    }
    // $ANTLR end synpred5_ttcn3

    // $ANTLR start synpred13_ttcn3
    public final void synpred13_ttcn3_fragment() throws RecognitionException {   
        // ttcn3.g:144:4: ( 'record' | 'component' )
        // ttcn3.g:
        {
        if ( input.LA(1)==30||input.LA(1)==32 ) {
            input.consume();
            state.errorRecovery=false;state.failed=false;
        }
        else {
            if (state.backtracking>0) {state.failed=true; return ;}
            MismatchedSetException mse = new MismatchedSetException(null,input);
            throw mse;
        }


        }
    }
    // $ANTLR end synpred13_ttcn3

    // $ANTLR start synpred58_ttcn3
    public final void synpred58_ttcn3_fragment() throws RecognitionException {   
        // ttcn3.g:648:13: ( expr )
        // ttcn3.g:648:13: expr
        {
        pushFollow(FOLLOW_expr_in_synpred58_ttcn31941);
        expr();

        state._fsp--;
        if (state.failed) return ;

        }
    }
    // $ANTLR end synpred58_ttcn3

    // Delegated rules

    public final boolean synpred58_ttcn3() {
        state.backtracking++;
        int start = input.mark();
        try {
            synpred58_ttcn3_fragment(); // can never throw exception
        } catch (RecognitionException re) {
            System.err.println("impossible: "+re);
        }
        boolean success = !state.failed;
        input.rewind(start);
        state.backtracking--;
        state.failed=false;
        return success;
    }
    public final boolean synpred13_ttcn3() {
        state.backtracking++;
        int start = input.mark();
        try {
            synpred13_ttcn3_fragment(); // can never throw exception
        } catch (RecognitionException re) {
            System.err.println("impossible: "+re);
        }
        boolean success = !state.failed;
        input.rewind(start);
        state.backtracking--;
        state.failed=false;
        return success;
    }
    public final boolean synpred5_ttcn3() {
        state.backtracking++;
        int start = input.mark();
        try {
            synpred5_ttcn3_fragment(); // can never throw exception
        } catch (RecognitionException re) {
            System.err.println("impossible: "+re);
        }
        boolean success = !state.failed;
        input.rewind(start);
        state.backtracking--;
        state.failed=false;
        return success;
    }


    protected DFA30 dfa30 = new DFA30(this);
    protected DFA43 dfa43 = new DFA43(this);
    static final String DFA30_eotS =
        "\7\uffff";
    static final String DFA30_eofS =
        "\7\uffff";
    static final String DFA30_minS =
        "\1\22\1\45\3\uffff\1\22\1\45";
    static final String DFA30_maxS =
        "\1\74\1\66\3\uffff\1\67\1\66";
    static final String DFA30_acceptS =
        "\2\uffff\1\1\1\2\1\3\2\uffff";
    static final String DFA30_specialS =
        "\7\uffff}>";
    static final String[] DFA30_transitionS = {
            "\1\1\26\uffff\1\3\5\uffff\1\4\3\uffff\3\4\2\uffff\1\3\2\2\1"+
            "\uffff\1\2",
            "\1\2\1\uffff\1\3\16\uffff\1\5",
            "",
            "",
            "",
            "\1\6\44\uffff\1\4",
            "\1\2\20\uffff\1\5"
    };

    static final short[] DFA30_eot = DFA.unpackEncodedString(DFA30_eotS);
    static final short[] DFA30_eof = DFA.unpackEncodedString(DFA30_eofS);
    static final char[] DFA30_min = DFA.unpackEncodedStringToUnsignedChars(DFA30_minS);
    static final char[] DFA30_max = DFA.unpackEncodedStringToUnsignedChars(DFA30_maxS);
    static final short[] DFA30_accept = DFA.unpackEncodedString(DFA30_acceptS);
    static final short[] DFA30_special = DFA.unpackEncodedString(DFA30_specialS);
    static final short[][] DFA30_transition;

    static {
        int numStates = DFA30_transitionS.length;
        DFA30_transition = new short[numStates][];
        for (int i=0; i<numStates; i++) {
            DFA30_transition[i] = DFA.unpackEncodedString(DFA30_transitionS[i]);
        }
    }

    class DFA30 extends DFA {

        public DFA30(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 30;
            this.eot = DFA30_eot;
            this.eof = DFA30_eof;
            this.min = DFA30_min;
            this.max = DFA30_max;
            this.accept = DFA30_accept;
            this.special = DFA30_special;
            this.transition = DFA30_transition;
        }
        public String getDescription() {
            return "471:1: functionStatement : ( basicStatements | behaviourStatements | configurationStatements );";
        }
    }
    static final String DFA43_eotS =
        "\26\uffff";
    static final String DFA43_eofS =
        "\1\10\25\uffff";
    static final String DFA43_minS =
        "\1\16\5\uffff\1\0\17\uffff";
    static final String DFA43_maxS =
        "\1\112\5\uffff\1\0\17\uffff";
    static final String DFA43_acceptS =
        "\1\uffff\1\1\6\uffff\1\2\15\uffff";
    static final String DFA43_specialS =
        "\6\uffff\1\0\17\uffff}>";
    static final String[] DFA43_transitionS = {
            "\1\10\1\uffff\2\1\1\6\5\uffff\1\10\13\uffff\1\10\2\uffff\1"+
            "\1\1\uffff\1\10\4\uffff\2\10\3\uffff\3\10\2\uffff\3\10\1\uffff"+
            "\1\10\6\uffff\2\1\4\uffff\2\1",
            "",
            "",
            "",
            "",
            "",
            "\1\uffff",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            ""
    };

    static final short[] DFA43_eot = DFA.unpackEncodedString(DFA43_eotS);
    static final short[] DFA43_eof = DFA.unpackEncodedString(DFA43_eofS);
    static final char[] DFA43_min = DFA.unpackEncodedStringToUnsignedChars(DFA43_minS);
    static final char[] DFA43_max = DFA.unpackEncodedStringToUnsignedChars(DFA43_maxS);
    static final short[] DFA43_accept = DFA.unpackEncodedString(DFA43_acceptS);
    static final short[] DFA43_special = DFA.unpackEncodedString(DFA43_specialS);
    static final short[][] DFA43_transition;

    static {
        int numStates = DFA43_transitionS.length;
        DFA43_transition = new short[numStates][];
        for (int i=0; i<numStates; i++) {
            DFA43_transition[i] = DFA.unpackEncodedString(DFA43_transitionS[i]);
        }
    }

    class DFA43 extends DFA {

        public DFA43(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 43;
            this.eot = DFA43_eot;
            this.eof = DFA43_eof;
            this.min = DFA43_min;
            this.max = DFA43_max;
            this.accept = DFA43_accept;
            this.special = DFA43_special;
            this.transition = DFA43_transition;
        }
        public String getDescription() {
            return "648:13: ( expr )?";
        }
        public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
            TokenStream input = (TokenStream)_input;
        	int _s = s;
            switch ( s ) {
                    case 0 : 
                        int LA43_6 = input.LA(1);

                         
                        int index43_6 = input.index();
                        input.rewind();
                        s = -1;
                        if ( (synpred58_ttcn3()) ) {s = 1;}

                        else if ( (( (input.LA(-1)==RCURLY) || (input.LA(1)==RCURLY))) ) {s = 8;}

                         
                        input.seek(index43_6);
                        if ( s>=0 ) return s;
                        break;
            }
            if (state.backtracking>0) {state.failed=true; return -1;}
            NoViableAltException nvae =
                new NoViableAltException(getDescription(), 43, _s, input);
            error(nvae);
            throw nvae;
        }
    }
 

    public static final BitSet FOLLOW_ttcn3Modules_in_ttcn3File113 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ttcn3Module_in_ttcn3Modules125 = new BitSet(new long[]{0x0000000000800002L});
    public static final BitSet FOLLOW_EOF_in_ttcn3Modules133 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_23_in_ttcn3Module155 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_ttcn3Module157 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_LCURLY_in_ttcn3Module169 = new BitSet(new long[]{0x0000105026004000L});
    public static final BitSet FOLLOW_moduleDefinitionList_in_ttcn3Module174 = new BitSet(new long[]{0x0000000002004000L});
    public static final BitSet FOLLOW_moduleControlPart_in_ttcn3Module180 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_RCURLY_in_ttcn3Module185 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_24_in_semiColon235 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_24_in_semiColon245 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_25_in_moduleControlPart261 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_statementBlock_in_moduleControlPart263 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_moduleDefinition_in_moduleDefinitionList292 = new BitSet(new long[]{0x0000105025000000L});
    public static final BitSet FOLLOW_semiColon_in_moduleDefinitionList295 = new BitSet(new long[]{0x0000105024000002L});
    public static final BitSet FOLLOW_typeDef_in_moduleDefinition318 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_constDef_in_moduleDefinition323 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionDef_in_moduleDefinition328 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_importDef_in_moduleDefinition333 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_testcaseDef_in_moduleDefinition340 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_26_in_importDef351 = new BitSet(new long[]{0x0000000008000000L});
    public static final BitSet FOLLOW_27_in_importDef354 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_importDef356 = new BitSet(new long[]{0x0000000010000000L});
    public static final BitSet FOLLOW_28_in_importDef358 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_29_in_typeDef369 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_typeDefBody_in_typeDef372 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_structuredTypeDef_in_typeDefBody392 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_subTypeDef_in_typeDefBody396 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_recordDef_in_structuredTypeDef413 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_componentDef_in_structuredTypeDef418 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_30_in_recordDef429 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_structDefBody_in_recordDef432 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_id_in_structDefBody447 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_LCURLY_in_structDefBody454 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_structFieldDef_in_structDefBody456 = new BitSet(new long[]{0x0000000080004000L});
    public static final BitSet FOLLOW_31_in_structDefBody460 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_structFieldDef_in_structDefBody462 = new BitSet(new long[]{0x0000000080004000L});
    public static final BitSet FOLLOW_RCURLY_in_structDefBody470 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_typeName_in_structFieldDef494 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_structFieldDef498 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_typeName_in_subTypeDef523 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_subTypeDef525 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_32_in_componentDef555 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_componentDef557 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_LCURLY_in_componentDef566 = new BitSet(new long[]{0x0000401000004000L});
    public static final BitSet FOLLOW_componentDefList_in_componentDef573 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_RCURLY_in_componentDef579 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_componentElementDef_in_componentDefList606 = new BitSet(new long[]{0x0000401001000000L});
    public static final BitSet FOLLOW_semiColon_in_componentDefList609 = new BitSet(new long[]{0x0000401000000002L});
    public static final BitSet FOLLOW_varInstance_in_componentElementDef631 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_constDef_in_componentElementDef639 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_33_in_typeName668 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_34_in_typeName677 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_35_in_typeName686 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_id_in_typeName695 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_36_in_constDef721 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_typeName_in_constDef724 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_constInitial_in_constDef741 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_31_in_constDef745 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_constInitial_in_constDef747 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_id_in_constInitial782 = new BitSet(new long[]{0x0000002000000000L});
    public static final BitSet FOLLOW_37_in_constInitial784 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_constExpr_in_constInitial787 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_38_in_functionDef804 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_functionDef806 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_functionDef818 = new BitSet(new long[]{0x0000010F40040000L});
    public static final BitSet FOLLOW_functionFormalParList_in_functionDef820 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_functionDef824 = new BitSet(new long[]{0x0000060000008000L});
    public static final BitSet FOLLOW_runsOnSpec_in_functionDef826 = new BitSet(new long[]{0x0000020000008000L});
    public static final BitSet FOLLOW_returnType_in_functionDef829 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_statementBlock_in_functionDef840 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_41_in_returnType876 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_typeName_in_returnType879 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_42_in_runsOnSpec895 = new BitSet(new long[]{0x0000080000000000L});
    public static final BitSet FOLLOW_43_in_runsOnSpec897 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_componentType_in_runsOnSpec899 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionFormalPar_in_functionFormalParList926 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_31_in_functionFormalParList930 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_functionFormalPar_in_functionFormalParList932 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_formalValuePar_in_functionFormalPar959 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_typeName_in_formalValuePar982 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_formalValuePar984 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LCURLY_in_statementBlock1021 = new BitSet(new long[]{0x1738C21000074000L,0x0000000000000600L});
    public static final BitSet FOLLOW_functionStatementOrDefList_in_statementBlock1023 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_RCURLY_in_statementBlock1026 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionStatementOrDef_in_functionStatementOrDefList1050 = new BitSet(new long[]{0x1738C21001070000L,0x0000000000000600L});
    public static final BitSet FOLLOW_semiColon_in_functionStatementOrDefList1054 = new BitSet(new long[]{0x1738C21000070002L,0x0000000000000600L});
    public static final BitSet FOLLOW_functionLocalDef_in_functionStatementOrDef1074 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionStatement_in_functionStatementOrDef1079 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_constDef_in_functionLocalDef1089 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_varInstance_in_functionLocalDef1094 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_44_in_testcaseDef1111 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_testcaseDef1114 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_testcaseDef1125 = new BitSet(new long[]{0x0000010F40040000L});
    public static final BitSet FOLLOW_testcaseFormalParList_in_testcaseDef1127 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_testcaseDef1131 = new BitSet(new long[]{0x0000040000000000L});
    public static final BitSet FOLLOW_runsOnSpec_in_testcaseDef1135 = new BitSet(new long[]{0x0000200000008000L});
    public static final BitSet FOLLOW_systemSpec_in_testcaseDef1137 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_statementBlock_in_testcaseDef1140 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_45_in_systemSpec1159 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_systemSpec1162 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_testcaseFormalPar_in_testcaseFormalParList1176 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_31_in_testcaseFormalParList1180 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_testcaseFormalPar_in_testcaseFormalParList1182 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_formalValuePar_in_testcaseFormalPar1207 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_46_in_varInstance1229 = new BitSet(new long[]{0x0000000F40040000L});
    public static final BitSet FOLLOW_typeName_in_varInstance1231 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_var_in_varInstance1236 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_31_in_varInstance1240 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_var_in_varInstance1242 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_id_in_var1279 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_id_in_var1286 = new BitSet(new long[]{0x0000002000000000L});
    public static final BitSet FOLLOW_37_in_var1288 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_expr_in_var1291 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_basicStatements_in_functionStatement1305 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_behaviourStatements_in_functionStatement1310 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_configurationStatements_in_functionStatement1315 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_assignment_in_basicStatements1325 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_logStatement_in_basicStatements1330 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_loopConstruct_in_basicStatements1335 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_conditionalConstruct_in_basicStatements1340 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_returnStatement_in_behaviourStatements1352 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionInstance_in_behaviourStatements1357 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_testcaseInstance_in_behaviourStatements1362 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_startTCStatement_in_configurationStatements1375 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_connectStatement_in_configurationStatements1380 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_disconnectStatement_in_configurationStatements1385 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_mapStatement_in_configurationStatements1390 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_unmapStatement_in_configurationStatements1395 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_47_in_connectStatement1410 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_singleConnectionSpec_in_connectStatement1413 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_39_in_singleConnectionSpec1424 = new BitSet(new long[]{0x0006200000040000L});
    public static final BitSet FOLLOW_portRef_in_singleConnectionSpec1426 = new BitSet(new long[]{0x0000000080000000L});
    public static final BitSet FOLLOW_31_in_singleConnectionSpec1428 = new BitSet(new long[]{0x0006200000040000L});
    public static final BitSet FOLLOW_portRef_in_singleConnectionSpec1430 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_singleConnectionSpec1432 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_componentRef_in_portRef1454 = new BitSet(new long[]{0x0001000000000000L});
    public static final BitSet FOLLOW_48_in_portRef1456 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_port_in_portRef1458 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_componentOrDefaultReference_in_componentRef1480 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_45_in_componentRef1486 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_49_in_componentRef1492 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_50_in_componentRef1498 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_portIdentifier_in_port1509 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_id_in_portIdentifier1521 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_51_in_disconnectStatement1535 = new BitSet(new long[]{0x0000008000000002L});
    public static final BitSet FOLLOW_singleOrMultiConnectionSpec_in_disconnectStatement1539 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_singleConnectionSpec_in_singleOrMultiConnectionSpec1552 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_52_in_mapStatement1567 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_singleConnectionSpec_in_mapStatement1570 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_53_in_unmapStatement1581 = new BitSet(new long[]{0x0000008000000002L});
    public static final BitSet FOLLOW_singleOrMultiConnectionSpec_in_unmapStatement1585 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_componentOrDefaultReference_in_startTCStatement1599 = new BitSet(new long[]{0x0040000000000000L});
    public static final BitSet FOLLOW_54_in_startTCStatement1601 = new BitSet(new long[]{0x0080000000000000L});
    public static final BitSet FOLLOW_55_in_startTCStatement1603 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_startTCStatement1605 = new BitSet(new long[]{0x0000000000070000L,0x0000000000000600L});
    public static final BitSet FOLLOW_functionInstance_in_startTCStatement1607 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_startTCStatement1609 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_variableRef_in_componentOrDefaultReference1631 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_56_in_testcaseInstance1644 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_testcaseInstance1646 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_testcaseInstance1648 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_testcaseInstance1650 = new BitSet(new long[]{0x0000018000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_testcaseActualParList_in_testcaseInstance1652 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_testcaseInstance1655 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_testcaseInstance1659 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_actualArgs_in_testcaseActualParList1682 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_57_in_loopConstruct1694 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_loopConstruct1696 = new BitSet(new long[]{0x0000400000040000L});
    public static final BitSet FOLLOW_initExpr_in_loopConstruct1698 = new BitSet(new long[]{0x0000000001000000L});
    public static final BitSet FOLLOW_24_in_loopConstruct1700 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_conditionExpr_in_loopConstruct1702 = new BitSet(new long[]{0x0000000001000000L});
    public static final BitSet FOLLOW_24_in_loopConstruct1704 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_stepExpr_in_loopConstruct1706 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_loopConstruct1708 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_statementBlock_in_loopConstruct1710 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_varInstance_in_initExpr1736 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_assignment_in_initExpr1741 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_boolExpr_in_conditionExpr1751 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_assignment_in_stepExpr1761 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_58_in_conditionalConstruct1772 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_conditionalConstruct1774 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_boolExpr_in_conditionalConstruct1776 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_conditionalConstruct1778 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_statementBlock_in_conditionalConstruct1782 = new BitSet(new long[]{0x0800000000000002L});
    public static final BitSet FOLLOW_59_in_conditionalConstruct1795 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_statementBlock_in_conditionalConstruct1799 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_60_in_logStatement1853 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_logStatement1855 = new BitSet(new long[]{0x0000018000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_actualArgs_in_logStatement1857 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_logStatement1860 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_id_in_functionInstance1881 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_functionInstance1883 = new BitSet(new long[]{0x0000018000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_actualArgs_in_functionInstance1885 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_functionInstance1888 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_actualArgs1911 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_31_in_actualArgs1914 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_expr_in_actualArgs1916 = new BitSet(new long[]{0x0000000080000002L});
    public static final BitSet FOLLOW_41_in_returnStatement1939 = new BitSet(new long[]{0x0000008000070002L,0x0000000000000618L});
    public static final BitSet FOLLOW_expr_in_returnStatement1941 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_variableRef_in_assignment1962 = new BitSet(new long[]{0x0000002000000000L});
    public static final BitSet FOLLOW_37_in_assignment1964 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_expr_in_assignment1967 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_id_in_variableRef1977 = new BitSet(new long[]{0x0040000000000000L});
    public static final BitSet FOLLOW_54_in_variableRef1980 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_id_in_variableRef1982 = new BitSet(new long[]{0x0040000000000002L});
    public static final BitSet FOLLOW_id_in_variableRef2002 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_constExpr2018 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_boolExpr2028 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_relExpr_in_expr2039 = new BitSet(new long[]{0x6000000000000002L});
    public static final BitSet FOLLOW_61_in_expr2044 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_62_in_expr2049 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_relExpr_in_expr2054 = new BitSet(new long[]{0x6000000000000002L});
    public static final BitSet FOLLOW_addExpr_in_relExpr2066 = new BitSet(new long[]{0x8000000000000002L,0x0000000000000007L});
    public static final BitSet FOLLOW_63_in_relExpr2071 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_64_in_relExpr2076 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_65_in_relExpr2081 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_66_in_relExpr2086 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_addExpr_in_relExpr2090 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_mulExpr_in_addExpr2102 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000038L});
    public static final BitSet FOLLOW_67_in_addExpr2107 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_68_in_addExpr2112 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_69_in_addExpr2117 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_mulExpr_in_addExpr2122 = new BitSet(new long[]{0x0000000000000002L,0x0000000000000038L});
    public static final BitSet FOLLOW_unaryExpr_in_mulExpr2134 = new BitSet(new long[]{0x0000000000000002L,0x00000000000001C0L});
    public static final BitSet FOLLOW_70_in_mulExpr2139 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_71_in_mulExpr2144 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_72_in_mulExpr2149 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_unaryExpr_in_mulExpr2153 = new BitSet(new long[]{0x0000000000000002L,0x00000000000001C0L});
    public static final BitSet FOLLOW_68_in_unaryExpr2165 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_primary_in_unaryExpr2167 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_67_in_unaryExpr2182 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_primary_in_unaryExpr2184 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_primary_in_unaryExpr2199 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_value_in_primary2218 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_39_in_primary2223 = new BitSet(new long[]{0x0000008000070000L,0x0000000000000618L});
    public static final BitSet FOLLOW_expr_in_primary2225 = new BitSet(new long[]{0x0000010000000000L});
    public static final BitSet FOLLOW_40_in_primary2227 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_opCall_in_primary2236 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_INT_in_value2247 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Cstring_in_value2254 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_value2260 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_variableRef_in_value2272 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_functionInstance_in_value2305 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_configurationOps_in_opCall2316 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_createOp_in_configurationOps2332 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_componentType_in_createOp2349 = new BitSet(new long[]{0x0040000000000000L});
    public static final BitSet FOLLOW_54_in_createOp2351 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000800L});
    public static final BitSet FOLLOW_75_in_createOp2353 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_id_in_componentType2376 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_id2398 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_24_in_synpred5_ttcn3235 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_synpred13_ttcn3382 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_synpred58_ttcn31941 = new BitSet(new long[]{0x0000000000000002L});

}